diff options
author | Amar Tumballi <amar@gluster.com> | 2010-04-07 04:19:48 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-04-07 04:06:39 -0700 |
commit | 7cb8982cbbe8298cd1bdd35055f7d3818f4a136f (patch) | |
tree | b4a78391ab49b030fb155314f6b487341bc7158d | |
parent | d90c2f86ca7a8f6660e98da1e48c4798539b7d51 (diff) |
backword compatibility with 3.0.x releases - restored
* glusterfs.h - added back the removed 'fop' types in same order
* call-stub.c - enhanced logging in case of failure
* server-protocol.c - added a ENOSYS function for these fops, so
there will be no crash if a old client
connects to mainline server.
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 734 (keep only the working/usable code in build tree to focus more on development)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=734
-rw-r--r-- | libglusterfs/src/call-stub.c | 40 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 5 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-protocol.c | 125 |
3 files changed, 146 insertions, 24 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index ae67f59dc..5f73d9d6e 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -2553,11 +2553,11 @@ call_resume_wind (call_stub_t *stub) } default: { - gf_log ("call-stub", - GF_LOG_DEBUG, - "Invalid value of FOP"); + gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)", + stub->fop); + break; } - break; + } out: return; @@ -3371,13 +3371,12 @@ call_resume_unwind (call_stub_t *stub) &stub->args.fsetattr_cbk.statpost); break; } - case GF_FOP_MAXVALUE: + default: { - gf_log ("call-stub", - GF_LOG_DEBUG, - "Invalid value of FOP"); + gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)", + stub->fop); + break; } - break; } out: return; @@ -3681,15 +3680,12 @@ call_stub_destroy_wind (call_stub_t *stub) fd_unref (stub->args.fsetattr.fd); break; } - case GF_FOP_MAXVALUE: + default: { - gf_log ("call-stub", - GF_LOG_DEBUG, - "Invalid value of FOP"); + gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)", + stub->fop); + break; } - break; - default: - break; } } @@ -3914,16 +3910,12 @@ call_stub_destroy_unwind (call_stub_t *stub) break; } - case GF_FOP_MAXVALUE: + default: { - gf_log ("call-stub", - GF_LOG_DEBUG, - "Invalid value of FOP"); + gf_log ("call-stub", GF_LOG_ERROR, "Invalid value of FOP (%d)", + stub->fop); + break; } - break; - - default: - break; } } diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index cf87af7d3..5906b71ed 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -100,6 +100,7 @@ typedef enum { GF_FOP_GETXATTR, GF_FOP_REMOVEXATTR,/* 20 */ GF_FOP_OPENDIR, + GF_FOP_GETDENTS, GF_FOP_FSYNCDIR, GF_FOP_ACCESS, GF_FOP_CREATE, /* 25 */ @@ -107,6 +108,7 @@ typedef enum { GF_FOP_FSTAT, GF_FOP_LK, GF_FOP_LOOKUP, + GF_FOP_SETDENTS, GF_FOP_READDIR, GF_FOP_INODELK, /* 35 */ GF_FOP_FINODELK, @@ -115,6 +117,8 @@ typedef enum { GF_FOP_CHECKSUM, GF_FOP_XATTROP, /* 40 */ GF_FOP_FXATTROP, + GF_FOP_LOCK_NOTIFY, + GF_FOP_LOCK_FNOTIFY, GF_FOP_FGETXATTR, GF_FOP_FSETXATTR, /* 45 */ GF_FOP_RCHECKSUM, @@ -128,6 +132,7 @@ typedef enum { typedef enum { GF_MOP_SETVOLUME, /* 0 */ GF_MOP_GETVOLUME, /* 1 */ + GF_MOP_STATS, GF_MOP_SETSPEC, GF_MOP_GETSPEC, GF_MOP_PING, /* 5 */ diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index e2187085f..f9059eb92 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -5631,6 +5631,126 @@ mop_log (call_frame_t *frame, xlator_t *bound_xl, } +/* ENOSYS operations (for backword compatibility) */ +int +server_setdents (call_frame_t *frame, xlator_t *bound_xl, + gf_hdr_common_t *hdr, size_t hdrlen, + struct iobuf *iobuf) +{ + gf_hdr_common_t *rsp_hdr = NULL; + gf_mop_ping_rsp_t *rsp = NULL; /* Using for NULL */ + size_t rsp_hdrlen = 0; + int32_t gf_errno = 0; + + rsp_hdrlen = gf_hdr_len (rsp, 0); + rsp_hdr = gf_hdr_new (rsp, 0); + + gf_errno = gf_errno_to_error (ENOSYS); + hdr->rsp.op_errno = hton32 (gf_errno); + hdr->rsp.op_ret = -1; + + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_SETDENTS, + rsp_hdr, rsp_hdrlen, NULL, 0, NULL); + + return 0; +} + +/* */ +int +server_getdents (call_frame_t *frame, xlator_t *bound_xl, + gf_hdr_common_t *hdr, size_t hdrlen, + struct iobuf *iobuf) +{ + gf_hdr_common_t *rsp_hdr = NULL; + gf_mop_ping_rsp_t *rsp = NULL; /* Using for NULL */ + size_t rsp_hdrlen = 0; + int32_t gf_errno = 0; + + rsp_hdrlen = gf_hdr_len (rsp, 0); + rsp_hdr = gf_hdr_new (rsp, 0); + + gf_errno = gf_errno_to_error (ENOSYS); + hdr->rsp.op_errno = hton32 (gf_errno); + hdr->rsp.op_ret = -1; + + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_GETDENTS, + rsp_hdr, rsp_hdrlen, NULL, 0, NULL); + + return 0; +} + +/* */ +int +server_lock_notify (call_frame_t *frame, xlator_t *bound_xl, + gf_hdr_common_t *hdr, size_t hdrlen, + struct iobuf *iobuf) +{ + gf_hdr_common_t *rsp_hdr = NULL; + gf_mop_ping_rsp_t *rsp = NULL; /* Using for NULL */ + size_t rsp_hdrlen = 0; + int32_t gf_errno = 0; + + rsp_hdrlen = gf_hdr_len (rsp, 0); + rsp_hdr = gf_hdr_new (rsp, 0); + + gf_errno = gf_errno_to_error (ENOSYS); + hdr->rsp.op_errno = hton32 (gf_errno); + hdr->rsp.op_ret = -1; + + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_LOCK_NOTIFY, + rsp_hdr, rsp_hdrlen, NULL, 0, NULL); + + return 0; +} + +/* */ +int +server_lock_fnotify (call_frame_t *frame, xlator_t *bound_xl, + gf_hdr_common_t *hdr, size_t hdrlen, + struct iobuf *iobuf) +{ + gf_hdr_common_t *rsp_hdr = NULL; + gf_mop_ping_rsp_t *rsp = NULL; /* Using for NULL */ + size_t rsp_hdrlen = 0; + int32_t gf_errno = 0; + + rsp_hdrlen = gf_hdr_len (rsp, 0); + rsp_hdr = gf_hdr_new (rsp, 0); + + gf_errno = gf_errno_to_error (ENOSYS); + hdr->rsp.op_errno = hton32 (gf_errno); + hdr->rsp.op_ret = -1; + + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_LOCK_FNOTIFY, + rsp_hdr, rsp_hdrlen, NULL, 0, NULL); + + return 0; +} + + +int +mop_stats (call_frame_t *frame, xlator_t *bound_xl, + gf_hdr_common_t *hdr, size_t hdrlen, + struct iobuf *iobuf) +{ + gf_hdr_common_t *rsp_hdr = NULL; + gf_mop_ping_rsp_t *rsp = NULL; /* Using for NULL */ + size_t rsp_hdrlen = 0; + int32_t gf_errno = 0; + + rsp_hdrlen = gf_hdr_len (rsp, 0); + rsp_hdr = gf_hdr_new (rsp, 0); + + gf_errno = gf_errno_to_error (ENOSYS); + hdr->rsp.op_errno = hton32 (gf_errno); + hdr->rsp.op_ret = -1; + + protocol_server_reply (frame, GF_OP_TYPE_MOP_REPLY, GF_MOP_STATS, + rsp_hdr, rsp_hdrlen, NULL, 0, NULL); + + return 0; +} + /* * unknown_op_cbk - This function is called when a opcode for unknown * type is called. Helps to keep the backward/forward @@ -5820,6 +5940,10 @@ static gf_op_t gf_fops[] = { [GF_FOP_FXATTROP] = server_fxattrop, [GF_FOP_SETATTR] = server_setattr, [GF_FOP_FSETATTR] = server_fsetattr, + [GF_FOP_SETDENTS] = server_setdents, + [GF_FOP_GETDENTS] = server_getdents, + [GF_FOP_LOCK_NOTIFY] = server_lock_notify, + [GF_FOP_LOCK_FNOTIFY] = server_lock_fnotify, }; @@ -5830,6 +5954,7 @@ static gf_op_t gf_mops[] = { [GF_MOP_GETSPEC] = mop_getspec, [GF_MOP_PING] = mop_ping, [GF_MOP_LOG] = mop_log, + [GF_MOP_STATS] = mop_stats, }; static gf_op_t gf_cbks[] = { |