diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-03-20 17:22:24 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-03-22 16:40:27 -0700 |
commit | 9d3af972f516b6ba38d2736ce2016e34a452d569 (patch) | |
tree | 1dcdc620748a42cdfb5464c3adaae5a4a3a6f869 /xlators/protocol | |
parent | afe542eca18888463798747d2a95e5a9d239a4a0 (diff) |
core: adding extra data for fops
with this change, the xlator APIs will have a dictionary as extra
argument, which is passed between all the layers. This can be
utilized for overloading in some of the operations.
Change-Id: I58a8186b3ef647650280e63f3e5e9b9de7827b40
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 782265
Reviewed-on: http://review.gluster.com/2960
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r-- | xlators/protocol/client/src/client-handshake.c | 1 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-lk.c | 14 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.c | 233 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.h | 6 | ||||
-rw-r--r-- | xlators/protocol/client/src/client3_1-fops.c | 1237 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 19 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-resolve.c | 5 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.h | 3 | ||||
-rw-r--r-- | xlators/protocol/server/src/server3_1-fops.c | 1429 |
9 files changed, 2188 insertions, 759 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index 0a8759af586..944b9ca80b2 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -1202,7 +1202,6 @@ protocol_client_reopen (xlator_t *this, clnt_fd_ctx_t *fdctx) memcpy (req.gfid, inode->gfid, 16); req.flags = gf_flags_from_flags (fdctx->flags); - req.wbflags = fdctx->wbflags; gf_log (frame->this->name, GF_LOG_DEBUG, "attempting reopen on %s", local->loc.path); diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c index 4e87f7fcd13..76f78b846b0 100644 --- a/xlators/protocol/client/src/client-lk.c +++ b/xlators/protocol/client/src/client-lk.c @@ -621,7 +621,7 @@ client_remove_reserve_lock_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct gf_flock *lock) + struct gf_flock *lock, dict_t *xdata) { clnt_local_t *local = NULL; clnt_conf_t *conf = NULL; @@ -667,7 +667,7 @@ client_remove_reserve_lock (xlator_t *this, call_frame_t *frame, STACK_WIND (frame, client_remove_reserve_lock_cbk, this, this->fops->lk, - lock->fd, F_RESLK_UNLCK, &unlock); + lock->fd, F_RESLK_UNLCK, &unlock, NULL); } static client_posix_lock_t * @@ -699,7 +699,7 @@ client_reserve_lock_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct gf_flock *lock) + struct gf_flock *lock, dict_t *xdata) { clnt_local_t *local = NULL; @@ -755,7 +755,7 @@ client_recovery_lock_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct gf_flock *lock) + struct gf_flock *lock, dict_t *xdata) { clnt_local_t *local = NULL; clnt_fd_ctx_t *fdctx = NULL; @@ -795,7 +795,7 @@ client_recovery_lock_cbk (call_frame_t *frame, STACK_WIND (frame, client_reserve_lock_cbk, this, this->fops->lk, - next_lock->fd, F_RESLK_LCK, &reserve_flock); + next_lock->fd, F_RESLK_LCK, &reserve_flock, NULL); goto out; } @@ -832,7 +832,7 @@ client_send_recovery_lock (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, client_recovery_lock_cbk, this, this->fops->lk, lock->fd, F_SETLK, - &(lock->user_flock)); + &(lock->user_flock), NULL); return 0; } @@ -896,7 +896,7 @@ client_attempt_lock_recovery (xlator_t *this, clnt_fd_ctx_t *fdctx) STACK_WIND (frame, client_reserve_lock_cbk, this, this->fops->lk, - lock->fd, F_RESLK_LCK, &reserve_flock); + lock->fd, F_RESLK_LCK, &reserve_flock, NULL); out: return ret; diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 82d90d25779..0f55ca86e4f 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -349,7 +349,7 @@ out: int32_t client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xattr_req) + dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -361,7 +361,7 @@ client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, goto out; args.loc = loc; - args.dict = xattr_req; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_LOOKUP]; if (!proc) { @@ -383,7 +383,7 @@ out: int32_t -client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) +client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -395,6 +395,7 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) goto out; args.loc = loc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_STAT]; if (!proc) { @@ -407,14 +408,15 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (stat, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (stat, frame, -1, ENOTCONN, NULL, NULL); return 0; } int32_t -client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) +client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, + off_t offset, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -427,6 +429,7 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) args.loc = loc; args.offset = offset; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_TRUNCATE]; if (!proc) { @@ -439,7 +442,7 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (truncate, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (truncate, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; @@ -447,7 +450,8 @@ out: int32_t -client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) +client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, + off_t offset, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -460,6 +464,7 @@ client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) args.fd = fd; args.offset = offset; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FTRUNCATE]; if (!proc) { @@ -472,7 +477,7 @@ client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } @@ -480,7 +485,8 @@ out: int32_t -client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) +client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, + int32_t mask, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -493,6 +499,7 @@ client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) args.loc = loc; args.mask = mask; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_ACCESS]; if (!proc) { @@ -505,7 +512,7 @@ client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (access, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (access, frame, -1, ENOTCONN, NULL); return 0; } @@ -514,7 +521,8 @@ out: int32_t -client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) +client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, + size_t size, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -527,6 +535,7 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) args.loc = loc; args.size = size; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_READLINK]; if (!proc) { @@ -539,7 +548,7 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (readlink, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (readlink, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } @@ -547,7 +556,7 @@ out: int client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - dev_t rdev, dict_t *params) + dev_t rdev, mode_t umask, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -561,7 +570,8 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, args.loc = loc; args.mode = mode; args.rdev = rdev; - args.dict = params; + args.umask = umask; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_MKNOD]; if (!proc) { @@ -575,7 +585,7 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, out: if (ret) STACK_UNWIND_STRICT (mknod, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -583,7 +593,7 @@ out: int client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, - mode_t mode, dict_t *params) + mode_t mode, mode_t umask, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -596,7 +606,8 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, args.loc = loc; args.mode = mode; - args.dict = params; + args.umask = umask; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_MKDIR]; if (!proc) { @@ -610,7 +621,7 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, out: if (ret) STACK_UNWIND_STRICT (mkdir, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -618,7 +629,8 @@ out: int32_t -client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) +client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, + int xflag, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -630,6 +642,8 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) goto out; args.loc = loc; + args.xdata = xdata; + args.flags = xflag; proc = &conf->fops->proctable[GF_FOP_UNLINK]; if (!proc) { @@ -643,13 +657,14 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) out: if (ret) STACK_UNWIND_STRICT (unlink, frame, -1, ENOTCONN, - NULL, NULL); + NULL, NULL, NULL); return 0; } int32_t -client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags) +client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, + dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -662,6 +677,7 @@ client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags) args.loc = loc; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_RMDIR]; if (!proc) { @@ -676,7 +692,7 @@ out: /* think of avoiding a missing frame */ if (ret) STACK_UNWIND_STRICT (rmdir, frame, -1, ENOTCONN, - NULL, NULL); + NULL, NULL, NULL); return 0; } @@ -684,7 +700,7 @@ out: int client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, - loc_t *loc, dict_t *params) + loc_t *loc, mode_t umask, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -697,7 +713,8 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, args.linkname = linkpath; args.loc = loc; - args.dict = params; + args.umask = umask; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_SYMLINK]; if (!proc) { @@ -711,7 +728,7 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, out: if (ret) STACK_UNWIND_STRICT (symlink, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -720,7 +737,7 @@ out: int32_t client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, - loc_t *newloc) + loc_t *newloc, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -733,6 +750,8 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, args.oldloc = oldloc; args.newloc = newloc; + args.xdata = xdata; + proc = &conf->fops->proctable[GF_FOP_RENAME]; if (!proc) { gf_log (this->name, GF_LOG_ERROR, @@ -745,7 +764,7 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, out: if (ret) STACK_UNWIND_STRICT (rename, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -754,7 +773,7 @@ out: int32_t client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, - loc_t *newloc) + loc_t *newloc, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -767,6 +786,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, args.oldloc = oldloc; args.newloc = newloc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_LINK]; if (!proc) { @@ -780,7 +800,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, out: if (ret) STACK_UNWIND_STRICT (link, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -788,8 +808,8 @@ out: int32_t -client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, mode_t mode, fd_t *fd, dict_t *params) +client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -804,7 +824,8 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, args.flags = flags; args.mode = mode; args.fd = fd; - args.dict = params; + args.umask = umask; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_CREATE]; if (!proc) { @@ -818,7 +839,7 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, out: if (ret) STACK_UNWIND_STRICT (create, frame, -1, ENOTCONN, - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -827,7 +848,7 @@ out: int32_t client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd, int32_t wbflags) + int32_t flags, fd_t *fd, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -841,7 +862,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, args.loc = loc; args.flags = flags; args.fd = fd; - args.wbflags = wbflags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_OPEN]; if (!proc) { @@ -855,7 +876,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, out: if (ret) - STACK_UNWIND_STRICT (open, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (open, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -864,7 +885,7 @@ out: int32_t client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset, uint32_t flags) + off_t offset, uint32_t flags, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -879,6 +900,7 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, args.size = size; args.offset = offset; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_READ]; if (!proc) { @@ -893,7 +915,7 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, out: if (ret) STACK_UNWIND_STRICT (readv, frame, -1, ENOTCONN, - NULL, 0, NULL, NULL); + NULL, 0, NULL, NULL, NULL); return 0; } @@ -904,7 +926,7 @@ out: int32_t client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t off, - uint32_t flags, struct iobref *iobref) + uint32_t flags, struct iobref *iobref, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -921,6 +943,7 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, args.offset = off; args.flags = flags; args.iobref = iobref; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_WRITE]; if (!proc) { @@ -933,14 +956,14 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (writev, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (writev, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } int32_t -client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) +client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -952,6 +975,7 @@ client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) goto out; args.fd = fd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FLUSH]; if (!proc) { @@ -964,7 +988,7 @@ client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (flush, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (flush, frame, -1, ENOTCONN, NULL); return 0; } @@ -973,7 +997,7 @@ out: int32_t client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t flags) + int32_t flags, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -986,6 +1010,7 @@ client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSYNC]; if (!proc) { @@ -998,7 +1023,7 @@ client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fsync, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (fsync, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } @@ -1006,7 +1031,7 @@ out: int32_t -client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) +client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1018,6 +1043,7 @@ client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) goto out; args.fd = fd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSTAT]; if (!proc) { @@ -1030,7 +1056,7 @@ client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fstat, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (fstat, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1038,7 +1064,8 @@ out: int32_t -client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) +client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, + dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1051,6 +1078,7 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) args.loc = loc; args.fd = fd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_OPENDIR]; if (!proc) { @@ -1063,7 +1091,7 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (opendir, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (opendir, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1071,7 +1099,7 @@ out: int32_t -client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) +client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1084,6 +1112,7 @@ client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) args.fd = fd; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSYNCDIR]; if (!proc) { @@ -1096,7 +1125,7 @@ client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOTCONN, NULL); return 0; } @@ -1104,7 +1133,7 @@ out: int32_t -client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) +client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1116,6 +1145,7 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) goto out; args.loc = loc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_STATFS]; if (!proc) { @@ -1128,7 +1158,7 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (statfs, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (statfs, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1254,7 +1284,7 @@ out: int32_t client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, - int32_t flags) + int32_t flags, dict_t *xdata) { int ret = -1; int op_ret = -1; @@ -1302,8 +1332,9 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, } args.loc = loc; - args.dict = dict; + args.xattr = dict; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_SETXATTR]; if (!proc) { @@ -1320,7 +1351,7 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, } out: if (need_unwind) - STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno); + STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, NULL); return 0; } @@ -1329,7 +1360,7 @@ out: int32_t client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - dict_t *dict, int32_t flags) + dict_t *dict, int32_t flags, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1340,9 +1371,10 @@ client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, if (!conf || !conf->fops) goto out; - args.fd = fd; - args.dict = dict; + args.fd = fd; + args.xattr = dict; args.flags = flags; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSETXATTR]; if (!proc) { @@ -1355,7 +1387,7 @@ client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fsetxattr, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (fsetxattr, frame, -1, ENOTCONN, NULL); return 0; } @@ -1365,7 +1397,7 @@ out: int32_t client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - const char *name) + const char *name, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1378,6 +1410,7 @@ client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.name = name; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FGETXATTR]; if (!proc) { @@ -1390,7 +1423,7 @@ client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1399,7 +1432,7 @@ out: int32_t client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name) + const char *name, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1412,6 +1445,7 @@ client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, args.name = name; args.loc = loc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_GETXATTR]; if (!proc) { @@ -1424,7 +1458,7 @@ client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (getxattr, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (getxattr, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1433,7 +1467,7 @@ out: int32_t client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, - gf_xattrop_flags_t flags, dict_t *dict) + gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1446,7 +1480,8 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, args.loc = loc; args.flags = flags; - args.dict = dict; + args.xattr = dict; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_XATTROP]; if (!proc) { @@ -1459,7 +1494,7 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (xattrop, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (xattrop, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1468,7 +1503,7 @@ out: int32_t client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, - gf_xattrop_flags_t flags, dict_t *dict) + gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1481,7 +1516,8 @@ client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.flags = flags; - args.dict = dict; + args.xattr = dict; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FXATTROP]; if (!proc) { @@ -1494,7 +1530,7 @@ client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fxattrop, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (fxattrop, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1503,7 +1539,7 @@ out: int32_t client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name) + const char *name, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1516,6 +1552,7 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, args.name = name; args.loc = loc; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_REMOVEXATTR]; if (!proc) { @@ -1528,14 +1565,14 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (removexattr, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (removexattr, frame, -1, ENOTCONN, NULL); return 0; } int32_t client_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - const char *name) + const char *name, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1548,6 +1585,7 @@ client_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, args.name = name; args.fd = fd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FREMOVEXATTR]; if (!proc) { @@ -1560,14 +1598,14 @@ client_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fremovexattr, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (fremovexattr, frame, -1, ENOTCONN, NULL); return 0; } int32_t client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, - struct gf_flock *lock) + struct gf_flock *lock, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1581,6 +1619,7 @@ client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, args.fd = fd; args.cmd = cmd; args.flock = lock; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_LK]; if (!proc) { @@ -1593,7 +1632,7 @@ client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (lk, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (lk, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1601,7 +1640,7 @@ out: int32_t client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, - loc_t *loc, int32_t cmd, struct gf_flock *lock) + loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1616,6 +1655,7 @@ client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, args.cmd = cmd; args.flock = lock; args.volume = volume; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_INODELK]; if (!proc) { @@ -1628,7 +1668,7 @@ client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (inodelk, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (inodelk, frame, -1, ENOTCONN, NULL); return 0; } @@ -1637,7 +1677,7 @@ out: int32_t client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, - fd_t *fd, int32_t cmd, struct gf_flock *lock) + fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1652,6 +1692,7 @@ client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, args.cmd = cmd; args.flock = lock; args.volume = volume; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FINODELK]; if (!proc) { @@ -1664,7 +1705,7 @@ client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (finodelk, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (finodelk, frame, -1, ENOTCONN, NULL); return 0; } @@ -1673,7 +1714,7 @@ out: int32_t client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, - entrylk_type type) + entrylk_type type, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1689,6 +1730,7 @@ client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, args.type = type; args.volume = volume; args.cmd_entrylk = cmd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_ENTRYLK]; if (!proc) { @@ -1701,7 +1743,7 @@ client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (entrylk, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (entrylk, frame, -1, ENOTCONN, NULL); return 0; } @@ -1711,7 +1753,7 @@ out: int32_t client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, - entrylk_type type) + entrylk_type type, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1727,6 +1769,7 @@ client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, args.type = type; args.volume = volume; args.cmd_entrylk = cmd; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FENTRYLK]; if (!proc) { @@ -1739,7 +1782,7 @@ client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fentrylk, frame, -1, ENOTCONN); + STACK_UNWIND_STRICT (fentrylk, frame, -1, ENOTCONN, NULL); return 0; } @@ -1747,7 +1790,7 @@ out: int32_t client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - int32_t len) + int32_t len, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1761,6 +1804,7 @@ client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, args.fd = fd; args.offset = offset; args.len = len; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_RCHECKSUM]; if (!proc) { @@ -1773,14 +1817,14 @@ client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (rchecksum, frame, -1, ENOTCONN, 0, NULL); + STACK_UNWIND_STRICT (rchecksum, frame, -1, ENOTCONN, 0, NULL, NULL); return 0; } int32_t client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t off) + size_t size, off_t off, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1794,6 +1838,7 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.size = size; args.offset = off; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_READDIR]; if (!proc) { @@ -1806,7 +1851,7 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (readdir, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (readdir, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1828,7 +1873,7 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.size = size; args.offset = off; - args.dict = dict; + args.xdata = dict; proc = &conf->fops->proctable[GF_FOP_READDIRP]; if (!proc) { @@ -1841,7 +1886,7 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (readdirp, frame, -1, ENOTCONN, NULL); + STACK_UNWIND_STRICT (readdirp, frame, -1, ENOTCONN, NULL, NULL); return 0; } @@ -1849,7 +1894,7 @@ out: int32_t client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct iatt *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1863,6 +1908,7 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, args.loc = loc; args.stbuf = stbuf; args.valid = valid; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_SETATTR]; if (!proc) { @@ -1875,14 +1921,14 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (setattr, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (setattr, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } int32_t client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iatt *stbuf, int32_t valid) + struct iatt *stbuf, int32_t valid, dict_t *xdata) { int ret = -1; clnt_conf_t *conf = NULL; @@ -1896,6 +1942,7 @@ client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, args.fd = fd; args.stbuf = stbuf; args.valid = valid; + args.xdata = xdata; proc = &conf->fops->proctable[GF_FOP_FSETATTR]; if (!proc) { @@ -1908,7 +1955,7 @@ client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = proc->fn (frame, this, &args); out: if (ret) - STACK_UNWIND_STRICT (fsetattr, frame, -1, ENOTCONN, NULL, NULL); + STACK_UNWIND_STRICT (fsetattr, frame, -1, ENOTCONN, NULL, NULL, NULL); return 0; } diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index 91a411e8aea..1ca7b2e5784 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -169,13 +169,11 @@ typedef struct client_local { typedef struct client_args { loc_t *loc; fd_t *fd; - dict_t *xattr_req; const char *linkname; struct iobref *iobref; struct iovec *vector; dict_t *xattr; struct iatt *stbuf; - dict_t *dict; loc_t *oldloc; loc_t *newloc; const char *name; @@ -189,7 +187,6 @@ typedef struct client_args { mode_t mode; dev_t rdev; int32_t flags; - int32_t wbflags; int32_t count; int32_t datasync; entrylk_cmd cmd_entrylk; @@ -197,6 +194,9 @@ typedef struct client_args { gf_xattrop_flags_t optype; int32_t valid; int32_t len; + + mode_t umask; + dict_t *xdata; } clnt_args_t; typedef ssize_t (*gfs_serialize_t) (struct iovec outmsg, void *args); diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index fa9b930396a..e1c144a8a04 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -153,6 +153,7 @@ client3_1_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count, clnt_local_t *local = NULL; inode_t *inode = NULL; xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -181,6 +182,10 @@ client3_1_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.postparent, &postparent); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -191,7 +196,13 @@ out: CLIENT_STACK_UNWIND (symlink, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, - &preparent, &postparent); + &preparent, &postparent, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -210,6 +221,7 @@ client3_1_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count, clnt_local_t *local = NULL; inode_t *inode = NULL; xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -239,6 +251,10 @@ client3_1_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.postparent, &postparent); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -249,7 +265,14 @@ out: CLIENT_STACK_UNWIND (mknod, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), inode, - &stbuf, &preparent, &postparent); + &stbuf, &preparent, &postparent, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); + return 0; } @@ -266,6 +289,7 @@ client3_1_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count, clnt_local_t *local = NULL; inode_t *inode = NULL; xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -294,6 +318,10 @@ client3_1_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.postparent, &postparent); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -304,7 +332,13 @@ out: CLIENT_STACK_UNWIND (mkdir, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), inode, - &stbuf, &preparent, &postparent); + &stbuf, &preparent, &postparent, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -320,7 +354,9 @@ client3_1_open_cbk (struct rpc_req *req, struct iovec *iov, int count, fd_t *fd = NULL; int ret = 0; gfs3_open_rsp rsp = {0,}; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -371,6 +407,10 @@ client3_1_open_cbk (struct rpc_req *req, struct iovec *iov, int count, pthread_mutex_unlock (&conf->lock); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -380,7 +420,13 @@ out: } CLIENT_STACK_UNWIND (open, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), fd); + gf_error_to_errno (rsp.op_errno), fd, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -394,7 +440,9 @@ client3_1_stat_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; struct iatt iatt = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -417,13 +465,24 @@ client3_1_stat_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.stat, &iatt); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } + CLIENT_STACK_UNWIND (stat, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), &iatt); + gf_error_to_errno (rsp.op_errno), &iatt, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -436,7 +495,9 @@ client3_1_readlink_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; struct iatt iatt = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -459,19 +520,31 @@ client3_1_readlink_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.buf, &iatt); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } + CLIENT_STACK_UNWIND (readlink, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), rsp.path, &iatt); + gf_error_to_errno (rsp.op_errno), rsp.path, + &iatt, xdata); /* This is allocated by the libc while decoding RPC msg */ /* Hence no 'GF_FREE', but just 'free' */ if (rsp.path) free (rsp.path); + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); + return 0; } @@ -484,7 +557,9 @@ client3_1_unlink_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt preparent = {0,}; struct iatt postparent = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -508,6 +583,10 @@ client3_1_unlink_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.postparent, &postparent); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -515,7 +594,13 @@ out: } CLIENT_STACK_UNWIND (unlink, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &preparent, - &postparent); + &postparent, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -529,7 +614,9 @@ client3_1_rmdir_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt preparent = {0,}; struct iatt postparent = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -553,6 +640,10 @@ client3_1_rmdir_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.postparent, &postparent); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -560,7 +651,13 @@ out: } CLIENT_STACK_UNWIND (rmdir, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &preparent, - &postparent); + &postparent, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -575,7 +672,9 @@ client3_1_truncate_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt prestat = {0,}; struct iatt poststat = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -599,6 +698,10 @@ client3_1_truncate_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.poststat, &poststat); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -606,7 +709,13 @@ out: } CLIENT_STACK_UNWIND (truncate, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &prestat, - &poststat); + &poststat, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -620,7 +729,9 @@ client3_1_statfs_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; struct statvfs statfs = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -643,13 +754,23 @@ client3_1_statfs_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_statfs_to_statfs (&rsp.statfs, &statfs); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (statfs, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), &statfs); + gf_error_to_errno (rsp.op_errno), &statfs, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -664,7 +785,9 @@ client3_1_writev_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt prestat = {0,}; struct iatt poststat = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -689,6 +812,10 @@ client3_1_writev_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.poststat, &poststat); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -696,7 +823,13 @@ out: } CLIENT_STACK_UNWIND (writev, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &prestat, - &poststat); + &poststat, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -707,7 +840,9 @@ client3_1_flush_cbk (struct rpc_req *req, struct iovec *iov, int count, { call_frame_t *frame = NULL; clnt_local_t *local = NULL; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + gf_common_rsp rsp = {0,}; int ret = 0; @@ -736,6 +871,10 @@ client3_1_flush_cbk (struct rpc_req *req, struct iovec *iov, int count, lkowner_utoa (&local->owner), ret); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -743,7 +882,13 @@ out: strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (flush, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -757,7 +902,9 @@ client3_1_fsync_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt prestat = {0,}; struct iatt poststat = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -782,6 +929,10 @@ client3_1_fsync_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.poststat, &poststat); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -789,7 +940,13 @@ out: } CLIENT_STACK_UNWIND (fsync, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &prestat, - &poststat); + &poststat, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -801,7 +958,9 @@ client3_1_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -821,13 +980,23 @@ client3_1_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (setxattr, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -842,7 +1011,9 @@ client3_1_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, gfs3_getxattr_rsp rsp = {0,}; int ret = 0; clnt_local_t *local = NULL; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -871,6 +1042,10 @@ client3_1_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, op_errno, out); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -879,14 +1054,17 @@ out: (local) ? local->loc.path : "--"); } - CLIENT_STACK_UNWIND (getxattr, frame, rsp.op_ret, op_errno, dict); + CLIENT_STACK_UNWIND (getxattr, frame, rsp.op_ret, op_errno, dict, xdata); - if (rsp.dict.dict_val) { - /* don't use GF_FREE, this memory was allocated by libc - */ + /* don't use GF_FREE, this memory was allocated by libc */ + if (rsp.dict.dict_val) free (rsp.dict.dict_val); - rsp.dict.dict_val = NULL; - } + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); if (dict) dict_unref (dict); @@ -904,7 +1082,9 @@ client3_1_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, int ret = 0; int op_errno = EINVAL; clnt_local_t *local = NULL; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -931,6 +1111,10 @@ client3_1_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, (rsp.dict.dict_len), rsp.op_ret, op_errno, out); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -938,13 +1122,16 @@ out: strerror (op_errno)); } - CLIENT_STACK_UNWIND (fgetxattr, frame, rsp.op_ret, op_errno, dict); - if (rsp.dict.dict_val) { - /* don't use GF_FREE, this memory was allocated by libc - */ + CLIENT_STACK_UNWIND (fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata); + + if (rsp.dict.dict_val) free (rsp.dict.dict_val); - rsp.dict.dict_val = NULL; - } + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); if (dict) dict_unref (dict); @@ -959,7 +1146,8 @@ client3_1_removexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -979,13 +1167,24 @@ client3_1_removexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } + CLIENT_STACK_UNWIND (removexattr, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -997,7 +1196,9 @@ client3_1_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1017,13 +1218,23 @@ client3_1_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fremovexattr, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1035,7 +1246,9 @@ client3_1_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1054,13 +1267,23 @@ client3_1_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fsyncdir, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1072,7 +1295,9 @@ client3_1_access_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1091,13 +1316,23 @@ client3_1_access_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (access, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1112,7 +1347,9 @@ client3_1_ftruncate_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt prestat = {0,}; struct iatt poststat = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1136,6 +1373,10 @@ client3_1_ftruncate_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.poststat, &poststat); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -1143,7 +1384,13 @@ out: } CLIENT_STACK_UNWIND (ftruncate, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &prestat, - &poststat); + &poststat, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1156,7 +1403,9 @@ client3_1_fstat_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; struct iatt stat = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1179,13 +1428,23 @@ client3_1_fstat_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.stat, &stat); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fstat, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), &stat); + gf_error_to_errno (rsp.op_errno), &stat, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1198,7 +1457,9 @@ client3_1_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1217,6 +1478,10 @@ client3_1_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno (rsp.op_errno))) { @@ -1224,7 +1489,13 @@ out: strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (inodelk, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1236,7 +1507,9 @@ client3_1_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1255,6 +1528,10 @@ client3_1_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno (rsp.op_errno))) { @@ -1262,7 +1539,13 @@ out: strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (finodelk, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1274,7 +1557,9 @@ client3_1_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1293,15 +1578,25 @@ client3_1_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } -out: + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); +out: if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno (rsp.op_errno))) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } + CLIENT_STACK_UNWIND (entrylk, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1313,7 +1608,9 @@ client3_1_fentrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1332,14 +1629,25 @@ client3_1_fentrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno (rsp.op_errno))) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } + CLIENT_STACK_UNWIND (fentrylk, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1354,7 +1662,9 @@ client3_1_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, int ret = 0; int op_errno = EINVAL; clnt_local_t *local = NULL; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1382,6 +1692,10 @@ client3_1_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, op_errno, out); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -1391,14 +1705,16 @@ out: } CLIENT_STACK_UNWIND (xattrop, frame, rsp.op_ret, - gf_error_to_errno (op_errno), dict); + gf_error_to_errno (op_errno), dict, xdata); - if (rsp.dict.dict_val) { - /* don't use GF_FREE, this memory was allocated by libc - */ + if (rsp.dict.dict_val) free (rsp.dict.dict_val); - rsp.dict.dict_val = NULL; - } + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); if (dict) dict_unref (dict); @@ -1412,11 +1728,12 @@ client3_1_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, { call_frame_t *frame = NULL; dict_t *dict = NULL; + dict_t *xdata = NULL; gfs3_fxattrop_rsp rsp = {0,}; int ret = 0; int op_errno = 0; clnt_local_t *local = NULL; - xlator_t *this = NULL; + xlator_t *this = NULL; this = THIS; @@ -1444,6 +1761,10 @@ client3_1_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, op_errno, out); } + GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, xdata, + (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), rsp.op_ret, + op_errno, out); out: if (rsp.op_ret == -1) { @@ -1452,14 +1773,16 @@ out: strerror (gf_error_to_errno (op_errno))); } CLIENT_STACK_UNWIND (fxattrop, frame, rsp.op_ret, - gf_error_to_errno (op_errno), dict); + gf_error_to_errno (op_errno), dict, xdata); - if (rsp.dict.dict_val) { - /* don't use GF_FREE, this memory was allocated by libc - */ + if (rsp.dict.dict_val) free (rsp.dict.dict_val); - rsp.dict.dict_val = NULL; - } + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); if (dict) dict_unref (dict); @@ -1474,7 +1797,9 @@ client3_1_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gf_common_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1493,13 +1818,23 @@ client3_1_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (fsetxattr, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno)); + gf_error_to_errno (rsp.op_errno), xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1513,7 +1848,9 @@ client3_1_fsetattr_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt prestat = {0,}; struct iatt poststat = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1537,6 +1874,10 @@ client3_1_fsetattr_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.statpost, &poststat); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -1544,7 +1885,13 @@ out: } CLIENT_STACK_UNWIND (fsetattr, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &prestat, - &poststat); + &poststat, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1559,7 +1906,9 @@ client3_1_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt prestat = {0,}; struct iatt poststat = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1584,6 +1933,10 @@ client3_1_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.statpost, &poststat); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -1591,7 +1944,13 @@ out: } CLIENT_STACK_UNWIND (setattr, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &prestat, - &poststat); + &poststat, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1611,7 +1970,8 @@ client3_1_create_cbk (struct rpc_req *req, struct iovec *iov, int count, clnt_conf_t *conf = NULL; clnt_fd_ctx_t *fdctx = NULL; gfs3_create_rsp rsp = {0,}; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -1667,6 +2027,10 @@ client3_1_create_cbk (struct rpc_req *req, struct iovec *iov, int count, pthread_mutex_unlock (&conf->lock); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -1677,7 +2041,13 @@ out: CLIENT_STACK_UNWIND (create, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), fd, inode, - &stbuf, &preparent, &postparent); + &stbuf, &preparent, &postparent, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1690,7 +2060,9 @@ client3_1_rchecksum_cbk (struct rpc_req *req, struct iovec *iov, int count, call_frame_t *frame = NULL; gfs3_rchecksum_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1710,6 +2082,10 @@ client3_1_rchecksum_cbk (struct rpc_req *req, struct iovec *iov, int count, goto out; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -1718,7 +2094,8 @@ out: CLIENT_STACK_UNWIND (rchecksum, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), rsp.weak_checksum, - (uint8_t *)rsp.strong_checksum.strong_checksum_val); + (uint8_t *)rsp.strong_checksum.strong_checksum_val, + xdata); if (rsp.strong_checksum.strong_checksum_val) { /* This is allocated by the libc while decoding RPC msg */ @@ -1726,6 +2103,12 @@ out: free (rsp.strong_checksum.strong_checksum_val); } + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); + return 0; } @@ -1738,7 +2121,8 @@ client3_1_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, struct gf_flock lock = {0,}; gfs3_lk_rsp rsp = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -1777,6 +2161,10 @@ client3_1_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, } */ + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno (rsp.op_errno))) { @@ -1786,7 +2174,13 @@ out: } CLIENT_STACK_UNWIND (lk, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), &lock); + gf_error_to_errno (rsp.op_errno), &lock, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1795,12 +2189,13 @@ int client3_1_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - call_frame_t *frame = NULL; - gfs3_readdir_rsp rsp = {0,}; - int32_t ret = 0; - clnt_local_t *local = NULL; - gf_dirent_t entries; - xlator_t *this = NULL; + call_frame_t *frame = NULL; + gfs3_readdir_rsp rsp = {0,}; + int32_t ret = 0; + clnt_local_t *local = NULL; + gf_dirent_t entries; + xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -1826,6 +2221,11 @@ client3_1_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count, unserialize_rsp_dirent (&rsp, &entries); } + GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, xdata, + (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), rsp.op_ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -1834,12 +2234,18 @@ out: local->cmd); } CLIENT_STACK_UNWIND (readdir, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), &entries); + gf_error_to_errno (rsp.op_errno), &entries, xdata); if (rsp.op_ret != -1) { gf_dirent_free (&entries); } + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); + clnt_readdir_rsp_cleanup (&rsp); return 0; @@ -1856,6 +2262,7 @@ client3_1_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count, clnt_local_t *local = NULL; gf_dirent_t entries; xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -1881,6 +2288,10 @@ client3_1_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count, unserialize_rsp_direntp (this, local->fd, &rsp, &entries); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -1888,11 +2299,16 @@ out: strerror (gf_error_to_errno (rsp.op_errno))); } CLIENT_STACK_UNWIND (readdirp, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), &entries); + gf_error_to_errno (rsp.op_errno), &entries, xdata); if (rsp.op_ret != -1) { gf_dirent_free (&entries); } + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); clnt_readdirp_rsp_cleanup (&rsp); @@ -1912,7 +2328,8 @@ client3_1_rename_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt prenewparent = {0,}; struct iatt postnewparent = {0,}; int ret = 0; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -1942,6 +2359,10 @@ client3_1_rename_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.postnewparent, &postnewparent); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", @@ -1950,7 +2371,13 @@ out: CLIENT_STACK_UNWIND (rename, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), &stbuf, &preoldparent, &postoldparent, - &prenewparent, &postnewparent); + &prenewparent, &postnewparent, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -1967,7 +2394,9 @@ client3_1_link_cbk (struct rpc_req *req, struct iovec *iov, int count, int ret = 0; clnt_local_t *local = NULL; inode_t *inode = NULL; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; + this = THIS; @@ -1997,6 +2426,10 @@ client3_1_link_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_stat_to_iatt (&rsp.postparent, &postparent); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -2007,7 +2440,13 @@ out: CLIENT_STACK_UNWIND (link, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), inode, - &stbuf, &preparent, &postparent); + &stbuf, &preparent, &postparent, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -2024,7 +2463,8 @@ client3_1_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count, fd_t *fd = NULL; int ret = 0; gfs3_opendir_rsp rsp = {0,}; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -2073,6 +2513,10 @@ client3_1_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count, pthread_mutex_unlock (&conf->lock); } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -2081,7 +2525,13 @@ out: (local) ? local->loc.path : "--"); } CLIENT_STACK_UNWIND (opendir, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), fd); + gf_error_to_errno (rsp.op_errno), fd, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -2098,7 +2548,7 @@ client3_1_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count, struct iatt stbuf = {0,}; struct iatt postparent = {0,}; int op_errno = EINVAL; - dict_t *xattr = NULL; + dict_t *xdata = NULL; inode_t *inode = NULL; xlator_t *this = NULL; @@ -2131,8 +2581,8 @@ client3_1_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count, rsp.op_ret = -1; gf_stat_to_iatt (&rsp.stat, &stbuf); - GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, xattr, (rsp.dict.dict_val), - (rsp.dict.dict_len), rsp.op_ret, + GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), rsp.op_ret, op_errno, out); if ((!uuid_is_null (inode->gfid)) @@ -2161,16 +2611,13 @@ out: } CLIENT_STACK_UNWIND (lookup, frame, rsp.op_ret, rsp.op_errno, inode, - &stbuf, xattr, &postparent); + &stbuf, xdata, &postparent); - if (xattr) - dict_unref (xattr); + if (xdata) + dict_unref (xdata); - if (rsp.dict.dict_val) { - /* don't use GF_FREE, this memory was allocated by libc - */ - free (rsp.dict.dict_val); - } + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); return 0; } @@ -2186,7 +2633,8 @@ client3_1_readv_cbk (struct rpc_req *req, struct iovec *iov, int count, gfs3_read_rsp rsp = {0,}; int ret = 0, rspcount = 0; clnt_local_t *local = NULL; - xlator_t *this = NULL; + xlator_t *this = NULL; + dict_t *xdata = NULL; this = THIS; @@ -2218,6 +2666,10 @@ client3_1_readv_cbk (struct rpc_req *req, struct iovec *iov, int count, vector[0].iov_base = req->rsp[1].iov_base; rspcount = 1; } + GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val), + (rsp.xdata.xdata_len), ret, + rsp.op_errno, out); + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -2226,7 +2678,13 @@ out: } CLIENT_STACK_UNWIND (readv, frame, rsp.op_ret, gf_error_to_errno (rsp.op_errno), vector, rspcount, - &stat, iobref); + &stat, iobref, xdata); + + if (rsp.xdata.xdata_val) + free (rsp.xdata.xdata_val); + + if (xdata) + dict_unref (xdata); return 0; } @@ -2461,8 +2919,8 @@ client3_1_lookup (call_frame_t *frame, xlator_t *this, memcpy (req.gfid, args->loc->gfid, 16); } - if (args->dict) { - content = dict_get (args->dict, GF_CONTENT_KEY); + if (args->xdata) { + content = dict_get (args->xdata, GF_CONTENT_KEY); if (content != NULL) { rsp_iobref = iobref_new (); if (rsp_iobref == NULL) { @@ -2481,22 +2939,21 @@ client3_1_lookup (call_frame_t *frame, xlator_t *this, iobuf_unref (rsp_iobuf); rsphdr = &vector[0]; rsphdr->iov_base = iobuf_ptr (rsp_iobuf); - rsphdr->iov_len - = iobuf_pagesize (rsp_iobuf); + rsphdr->iov_len = iobuf_pagesize (rsp_iobuf); count = 1; rsp_iobuf = NULL; local->iobref = rsp_iobref; rsp_iobref = NULL; } - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, - (&req.dict.dict_val), - req.dict.dict_len, + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, + (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); } if (args->loc->name) - req.bname = (char *)args->loc->name; + req.bname = (char *)args->loc->name; else req.bname = ""; @@ -2510,8 +2967,8 @@ client3_1_lookup (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); + if (req.xdata.xdata_val) { + GF_FREE (req.xdata.xdata_val); } if (rsp_iobref != NULL) { @@ -2524,8 +2981,8 @@ unwind: CLIENT_STACK_UNWIND (lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL); - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); if (rsp_iobref != NULL) { iobref_unref (rsp_iobref); @@ -2538,8 +2995,6 @@ unwind: return 0; } - - int32_t client3_1_stat (call_frame_t *frame, xlator_t *this, void *data) @@ -2567,6 +3022,9 @@ client3_1_stat (call_frame_t *frame, xlator_t *this, unwind, op_errno, EINVAL); conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_STAT, client3_1_stat_cbk, NULL, NULL, 0, NULL, 0, NULL, @@ -2575,9 +3033,16 @@ client3_1_stat (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (stat, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (stat, frame, -1, op_errno, NULL, NULL); + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -2612,6 +3077,9 @@ client3_1_truncate (call_frame_t *frame, xlator_t *this, conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_TRUNCATE, client3_1_truncate_cbk, NULL, @@ -2621,9 +3089,15 @@ client3_1_truncate (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (truncate, frame, -1, op_errno, NULL, NULL); + CLIENT_STACK_UNWIND (truncate, frame, -1, op_errno, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -2652,6 +3126,9 @@ client3_1_ftruncate (call_frame_t *frame, xlator_t *this, req.fd = remote_fd; memcpy (req.gfid, args->fd->inode->gfid, 16); + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FTRUNCATE, client3_1_ftruncate_cbk, NULL, @@ -2661,9 +3138,15 @@ client3_1_ftruncate (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (ftruncate, frame, -1, op_errno, NULL, NULL); + CLIENT_STACK_UNWIND (ftruncate, frame, -1, op_errno, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -2699,6 +3182,9 @@ client3_1_access (call_frame_t *frame, xlator_t *this, conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_ACCESS, client3_1_access_cbk, NULL, @@ -2708,9 +3194,15 @@ client3_1_access (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (access, frame, -1, op_errno); + CLIENT_STACK_UNWIND (access, frame, -1, op_errno, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -2743,6 +3235,9 @@ client3_1_readlink (call_frame_t *frame, xlator_t *this, req.size = args->size; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_READLINK, client3_1_readlink_cbk, NULL, @@ -2752,9 +3247,15 @@ client3_1_readlink (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (readlink, frame, -1, op_errno, NULL, NULL); + CLIENT_STACK_UNWIND (readlink, frame, -1, op_errno, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -2790,6 +3291,9 @@ client3_1_unlink (call_frame_t *frame, xlator_t *this, req.bname = (char *)args->loc->name; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_UNLINK, client3_1_unlink_cbk, NULL, @@ -2798,9 +3302,16 @@ client3_1_unlink (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (unlink, frame, -1, op_errno, NULL, NULL); + CLIENT_STACK_UNWIND (unlink, frame, -1, op_errno, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -2833,9 +3344,12 @@ client3_1_rmdir (call_frame_t *frame, xlator_t *this, !uuid_is_null (*((uuid_t*)req.pargfid)), unwind, op_errno, EINVAL); req.bname = (char *)args->loc->name; - req.flags = args->flags; + req.xflags = args->flags; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_RMDIR, client3_1_rmdir_cbk, NULL, NULL, 0, NULL, 0, @@ -2843,9 +3357,15 @@ client3_1_rmdir (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (rmdir, frame, -1, op_errno, NULL, NULL); + CLIENT_STACK_UNWIND (rmdir, frame, -1, op_errno, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -2889,12 +3409,13 @@ client3_1_symlink (call_frame_t *frame, xlator_t *this, unwind, op_errno, EINVAL); req.linkname = (char *)args->linkname; req.bname = (char *)args->loc->name; - - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, (&req.dict.dict_val), - req.dict.dict_len, op_errno, unwind); + req.umask = args->umask; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_SYMLINK, client3_1_symlink_cbk, NULL, NULL, 0, NULL, @@ -2903,18 +3424,18 @@ client3_1_symlink (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: CLIENT_STACK_UNWIND (symlink, frame, -1, op_errno, NULL, NULL, NULL, - NULL); + NULL, NULL); + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } return 0; } @@ -2959,6 +3480,9 @@ client3_1_rename (call_frame_t *frame, xlator_t *this, req.newbname = (char *)args->newloc->name; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_RENAME, client3_1_rename_cbk, NULL, NULL, 0, NULL, 0, @@ -2967,10 +3491,17 @@ client3_1_rename (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: CLIENT_STACK_UNWIND (rename, frame, -1, op_errno, NULL, NULL, NULL, - NULL, NULL); + NULL, NULL, NULL); + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3024,6 +3555,9 @@ client3_1_link (call_frame_t *frame, xlator_t *this, req.newbname = (char *)args->newloc->name; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LINK, client3_1_link_cbk, NULL, NULL, 0, NULL, 0, NULL, @@ -3032,9 +3566,15 @@ client3_1_link (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (link, frame, -1, op_errno, NULL, NULL, NULL, NULL); + CLIENT_STACK_UNWIND (link, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3079,15 +3619,13 @@ client3_1_mknod (call_frame_t *frame, xlator_t *this, req.bname = (char *)args->loc->name; req.mode = args->mode; req.dev = args->rdev; - if (args->dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, - (&req.dict.dict_val), - req.dict.dict_len, - op_errno, unwind); - } + req.umask = args->umask; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_MKNOD, client3_1_mknod_cbk, NULL, NULL, 0, NULL, 0, @@ -3095,17 +3633,17 @@ client3_1_mknod (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: CLIENT_STACK_UNWIND (mknod, frame, -1, op_errno, NULL, NULL, NULL, - NULL); + NULL, NULL); + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } return 0; } @@ -3150,15 +3688,13 @@ client3_1_mkdir (call_frame_t *frame, xlator_t *this, req.bname = (char *)args->loc->name; req.mode = args->mode; - if (args->dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, - (&req.dict.dict_val), - req.dict.dict_len, - op_errno, unwind); - } + req.umask = args->umask; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_MKDIR, client3_1_mkdir_cbk, NULL, NULL, 0, NULL, 0, @@ -3166,17 +3702,17 @@ client3_1_mkdir (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: CLIENT_STACK_UNWIND (mkdir, frame, -1, op_errno, NULL, NULL, NULL, - NULL); + NULL, NULL); + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } return 0; } @@ -3222,15 +3758,13 @@ client3_1_create (call_frame_t *frame, xlator_t *this, req.bname = (char *)args->loc->name; req.mode = args->mode; req.flags = gf_flags_from_flags (args->flags); - if (args->dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, - (&req.dict.dict_val), - req.dict.dict_len, - op_errno, unwind); - } + req.umask = args->umask; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_CREATE, client3_1_create_cbk, NULL, NULL, 0, NULL, 0, @@ -3239,17 +3773,17 @@ client3_1_create (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: CLIENT_STACK_UNWIND (create, frame, -1, op_errno, NULL, NULL, NULL, - NULL, NULL); + NULL, NULL, NULL); + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); - if (req.dict.dict_val) { - GF_FREE (req.dict.dict_val); - } return 0; } @@ -3281,7 +3815,6 @@ client3_1_open (call_frame_t *frame, xlator_t *this, local->fd = fd_ref (args->fd); local->flags = args->flags; - local->wbflags = args->wbflags; loc_copy (&local->loc, args->loc); frame->local = local; @@ -3294,10 +3827,12 @@ client3_1_open (call_frame_t *frame, xlator_t *this, !uuid_is_null (*((uuid_t*)req.gfid)), unwind, op_errno, EINVAL); req.flags = gf_flags_from_flags (args->flags); - req.wbflags = args->wbflags; conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_OPEN, client3_1_open_cbk, NULL, NULL, 0, NULL, 0, NULL, @@ -3306,9 +3841,15 @@ client3_1_open (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (open, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (open, frame, -1, op_errno, NULL, NULL); + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3383,6 +3924,9 @@ client3_1_readv (call_frame_t *frame, xlator_t *this, rsp_iobref = NULL; frame->local = local; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_READ, client3_1_readv_cbk, NULL, NULL, 0, &rsp_vec, 1, @@ -3392,6 +3936,9 @@ client3_1_readv (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: if (rsp_iobuf) { @@ -3402,7 +3949,10 @@ unwind: iobref_unref (rsp_iobref); } - CLIENT_STACK_UNWIND (readv, frame, -1, op_errno, NULL, 0, NULL, NULL); + CLIENT_STACK_UNWIND (readv, frame, -1, op_errno, NULL, 0, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3446,10 +3996,16 @@ client3_1_writev (call_frame_t *frame, xlator_t *this, void *data) gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL); + CLIENT_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3489,6 +4045,9 @@ client3_1_flush (call_frame_t *frame, xlator_t *this, req.fd = remote_fd; memcpy (req.gfid, args->fd->inode->gfid, 16); + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FLUSH, client3_1_flush_cbk, NULL, NULL, 0, NULL, 0, @@ -3496,10 +4055,18 @@ client3_1_flush (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + + return 0; unwind: - CLIENT_STACK_UNWIND (flush, frame, -1, op_errno); + CLIENT_STACK_UNWIND (flush, frame, -1, op_errno, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3537,10 +4104,17 @@ client3_1_fsync (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (fsync, frame, -1, op_errno, NULL, NULL); + CLIENT_STACK_UNWIND (fsync, frame, -1, op_errno, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3568,6 +4142,9 @@ client3_1_fstat (call_frame_t *frame, xlator_t *this, req.fd = remote_fd; memcpy (req.gfid, args->fd->inode->gfid, 16); + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FSTAT, client3_1_fstat_cbk, NULL, NULL, 0, NULL, 0, @@ -3576,10 +4153,16 @@ client3_1_fstat (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (fstat, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (fstat, frame, -1, op_errno, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3632,10 +4215,16 @@ client3_1_opendir (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (opendir, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (opendir, frame, -1, op_errno, NULL, NULL); + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; } @@ -3666,6 +4255,9 @@ client3_1_fsyncdir (call_frame_t *frame, xlator_t *this, void *data) conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FSYNCDIR, client3_1_fsyncdir_cbk, NULL, NULL, 0, @@ -3675,10 +4267,16 @@ client3_1_fsyncdir (call_frame_t *frame, xlator_t *this, void *data) gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (fsyncdir, frame, -1, op_errno); + CLIENT_STACK_UNWIND (fsyncdir, frame, -1, op_errno, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3716,6 +4314,9 @@ client3_1_statfs (call_frame_t *frame, xlator_t *this, conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_STATFS, client3_1_statfs_cbk, NULL, NULL, 0, NULL, 0, @@ -3723,10 +4324,17 @@ client3_1_statfs (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (statfs, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (statfs, frame, -1, op_errno, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3758,8 +4366,8 @@ client3_1_setxattr (call_frame_t *frame, xlator_t *this, GF_ASSERT_AND_GOTO_WITH_ERROR (this->name, !uuid_is_null (*((uuid_t*)req.gfid)), unwind, op_errno, EINVAL); - if (args->dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, + if (args->xattr) { + GF_PROTOCOL_DICT_SERIALIZE (this, args->xattr, (&req.dict.dict_val), req.dict.dict_len, op_errno, unwind); @@ -3769,6 +4377,9 @@ client3_1_setxattr (call_frame_t *frame, xlator_t *this, conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_SETXATTR, client3_1_setxattr_cbk, NULL, NULL, 0, NULL, 0, NULL, @@ -3776,16 +4387,21 @@ client3_1_setxattr (call_frame_t *frame, xlator_t *this, if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) { + if (req.dict.dict_val) GF_FREE (req.dict.dict_val); - } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; unwind: - CLIENT_STACK_UNWIND (setxattr, frame, -1, op_errno); - if (req.dict.dict_val) { + CLIENT_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL); + if (req.dict.dict_val) GF_FREE (req.dict.dict_val); - } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3814,13 +4430,16 @@ client3_1_fsetxattr (call_frame_t *frame, xlator_t *this, req.flags = args->flags; memcpy (req.gfid, args->fd->inode->gfid, 16); - if (args->dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, + if (args->xattr) { + GF_PROTOCOL_DICT_SERIALIZE (this, args->xattr, (&req.dict.dict_val), req.dict.dict_len, op_errno, unwind); } + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FSETXATTR, client3_1_fsetxattr_cbk, NULL, NULL, 0, NULL, 0, NULL, @@ -3829,16 +4448,21 @@ client3_1_fsetxattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) { + if (req.dict.dict_val) GF_FREE (req.dict.dict_val); - } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; unwind: - CLIENT_STACK_UNWIND (fsetxattr, frame, -1, op_errno); - if (req.dict.dict_val) { + CLIENT_STACK_UNWIND (fsetxattr, frame, -1, op_errno, NULL); + if (req.dict.dict_val) GF_FREE (req.dict.dict_val); - } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -3909,6 +4533,9 @@ client3_1_fgetxattr (call_frame_t *frame, xlator_t *this, } memcpy (req.gfid, args->fd->inode->gfid, 16); + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FGETXATTR, client3_1_fgetxattr_cbk, NULL, @@ -3919,9 +4546,12 @@ client3_1_fgetxattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (fgetxattr, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (fgetxattr, frame, -1, op_errno, NULL, NULL); if (rsp_iobuf) { iobuf_unref (rsp_iobuf); @@ -3930,6 +4560,8 @@ unwind: if (rsp_iobref) { iobref_unref (rsp_iobref); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4032,6 +4664,9 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this, } } + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_GETXATTR, client3_1_getxattr_cbk, NULL, @@ -4042,6 +4677,9 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: if (rsp_iobuf) { @@ -4052,7 +4690,10 @@ unwind: iobref_unref (rsp_iobref); } - CLIENT_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict); + CLIENT_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, NULL); + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4121,8 +4762,8 @@ client3_1_xattrop (call_frame_t *frame, xlator_t *this, GF_ASSERT_AND_GOTO_WITH_ERROR (this->name, !uuid_is_null (*((uuid_t*)req.gfid)), unwind, op_errno, EINVAL); - if (args->dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, + if (args->xattr) { + GF_PROTOCOL_DICT_SERIALIZE (this, args->xattr, (&req.dict.dict_val), req.dict.dict_len, op_errno, unwind); @@ -4132,6 +4773,9 @@ client3_1_xattrop (call_frame_t *frame, xlator_t *this, conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_XATTROP, client3_1_xattrop_cbk, NULL, @@ -4142,12 +4786,15 @@ client3_1_xattrop (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) { + if (req.dict.dict_val) GF_FREE (req.dict.dict_val); - } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (xattrop, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (xattrop, frame, -1, op_errno, NULL, NULL); if (req.dict.dict_val) { GF_FREE (req.dict.dict_val); @@ -4160,6 +4807,8 @@ unwind: if (rsp_iobref) { iobref_unref (rsp_iobref); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; } @@ -4225,13 +4874,16 @@ client3_1_fxattrop (call_frame_t *frame, xlator_t *this, local->iobref = rsp_iobref; rsp_iobref = NULL; - if (args->dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, + if (args->xattr) { + GF_PROTOCOL_DICT_SERIALIZE (this, args->xattr, (&req.dict.dict_val), req.dict.dict_len, op_errno, unwind); } + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FXATTROP, client3_1_fxattrop_cbk, NULL, @@ -4242,31 +4894,32 @@ client3_1_fxattrop (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } - if (req.dict.dict_val) { + if (req.dict.dict_val) GF_FREE (req.dict.dict_val); - } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; unwind: - CLIENT_STACK_UNWIND (fxattrop, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (fxattrop, frame, -1, op_errno, NULL, NULL); - if (req.dict.dict_val) { + if (req.dict.dict_val) GF_FREE (req.dict.dict_val); - } - if (rsp_iobref) { + if (rsp_iobref) iobref_unref (rsp_iobref); - } - if (rsp_iobuf) { + if (rsp_iobuf) iobuf_unref (rsp_iobuf); - } + + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; } - int32_t client3_1_removexattr (call_frame_t *frame, xlator_t *this, void *data) @@ -4297,6 +4950,9 @@ client3_1_removexattr (call_frame_t *frame, xlator_t *this, conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_REMOVEXATTR, client3_1_removexattr_cbk, NULL, @@ -4306,9 +4962,15 @@ client3_1_removexattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (removexattr, frame, -1, op_errno); + CLIENT_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4339,6 +5001,9 @@ client3_1_fremovexattr (call_frame_t *frame, xlator_t *this, req.name = (char *)args->name; req.fd = remote_fd; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FREMOVEXATTR, client3_1_fremovexattr_cbk, NULL, @@ -4348,9 +5013,15 @@ client3_1_fremovexattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (fremovexattr, frame, -1, op_errno); + CLIENT_STACK_UNWIND (fremovexattr, frame, -1, op_errno, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4421,9 +5092,15 @@ client3_1_lk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (lk, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (lk, frame, -1, op_errno, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4487,6 +5164,9 @@ client3_1_inodelk (call_frame_t *frame, xlator_t *this, conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_INODELK, client3_1_inodelk_cbk, NULL, @@ -4496,9 +5176,15 @@ client3_1_inodelk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (inodelk, frame, -1, op_errno); + CLIENT_STACK_UNWIND (inodelk, frame, -1, op_errno, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4556,6 +5242,9 @@ client3_1_finodelk (call_frame_t *frame, xlator_t *this, gf_proto_flock_from_flock (&req.flock, args->flock); memcpy (req.gfid, args->fd->inode->gfid, 16); + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FINODELK, client3_1_finodelk_cbk, NULL, @@ -4565,9 +5254,14 @@ client3_1_finodelk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); return 0; unwind: - CLIENT_STACK_UNWIND (finodelk, frame, -1, op_errno); + CLIENT_STACK_UNWIND (finodelk, frame, -1, op_errno, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4609,6 +5303,9 @@ client3_1_entrylk (call_frame_t *frame, xlator_t *this, conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_ENTRYLK, client3_1_entrylk_cbk, NULL, @@ -4618,9 +5315,15 @@ client3_1_entrylk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (entrylk, frame, -1, op_errno); + CLIENT_STACK_UNWIND (entrylk, frame, -1, op_errno, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4656,6 +5359,9 @@ client3_1_fentrylk (call_frame_t *frame, xlator_t *this, } memcpy (req.gfid, args->fd->inode->gfid, 16); + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_FENTRYLK, client3_1_fentrylk_cbk, NULL, @@ -4665,9 +5371,15 @@ client3_1_fentrylk (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (fentrylk, frame, -1, op_errno); + CLIENT_STACK_UNWIND (fentrylk, frame, -1, op_errno, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4695,6 +5407,9 @@ client3_1_rchecksum (call_frame_t *frame, xlator_t *this, req.offset = args->offset; req.fd = remote_fd; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_RCHECKSUM, client3_1_rchecksum_cbk, NULL, @@ -4705,9 +5420,15 @@ client3_1_rchecksum (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (rchecksum, frame, -1, op_errno, 0, NULL); + CLIENT_STACK_UNWIND (rchecksum, frame, -1, op_errno, 0, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4782,6 +5503,8 @@ client3_1_readdir (call_frame_t *frame, xlator_t *this, local->cmd = remote_fd; memcpy (req.gfid, args->fd->inode->gfid, 16); + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_READDIR, @@ -4795,6 +5518,9 @@ client3_1_readdir (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: @@ -4806,7 +5532,10 @@ unwind: iobuf_unref (rsp_iobuf); } - CLIENT_STACK_UNWIND (readdir, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (readdir, frame, -1, op_errno, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4882,12 +5611,9 @@ client3_1_readdirp (call_frame_t *frame, xlator_t *this, req.fd = remote_fd; memcpy (req.gfid, args->fd->inode->gfid, 16); - if (args->dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, args->dict, - (&req.dict.dict_val), - req.dict.dict_len, - op_errno, unwind); - } + /* dict itself is 'xdata' here */ + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.dict.dict_val), + req.dict.dict_len, op_errno, unwind); ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_READDIRP, @@ -4915,7 +5641,7 @@ unwind: if (req.dict.dict_val) GF_FREE (req.dict.dict_val); - CLIENT_STACK_UNWIND (readdirp, frame, -1, op_errno, NULL); + CLIENT_STACK_UNWIND (readdirp, frame, -1, op_errno, NULL, NULL); return 0; } @@ -4951,6 +5677,9 @@ client3_1_setattr (call_frame_t *frame, xlator_t *this, conf = this->private; + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_SETATTR, client3_1_setattr_cbk, NULL, @@ -4960,9 +5689,15 @@ client3_1_setattr (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (setattr, frame, -1, op_errno, NULL, NULL); + CLIENT_STACK_UNWIND (setattr, frame, -1, op_errno, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } @@ -4997,9 +5732,15 @@ client3_1_fsetattr (call_frame_t *frame, xlator_t *this, void *data) gf_log (this->name, GF_LOG_WARNING, "failed to send the fop"); } + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; unwind: - CLIENT_STACK_UNWIND (fsetattr, frame, -1, op_errno, NULL, NULL); + CLIENT_STACK_UNWIND (fsetattr, frame, -1, op_errno, NULL, NULL, NULL); + if (req.xdata.xdata_val) + GF_FREE (req.xdata.xdata_val); + return 0; } diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index adcf9c1f1ed..7ccd629e791 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -116,6 +116,11 @@ free_state (server_state_t *state) state->dict = NULL; } + if (state->xdata) { + dict_unref (state->xdata); + state->xdata = NULL; + } + if (state->volume) GF_FREE ((void *)state->volume); @@ -249,7 +254,7 @@ out: static int server_nop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { int ret = -1; server_state_t *state = NULL; @@ -334,7 +339,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, STACK_WIND (tmp_frame, server_nop_cbk, bound_xl, bound_xl->fops->finodelk, locker->volume, - locker->fd, F_SETLK, &flock); + locker->fd, F_SETLK, &flock, NULL); fd_unref (locker->fd); } else { gf_log (this->name, GF_LOG_INFO, "inodelk released " @@ -343,7 +348,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, STACK_WIND (tmp_frame, server_nop_cbk, bound_xl, bound_xl->fops->inodelk, locker->volume, - &(locker->loc), F_SETLK, &flock); + &(locker->loc), F_SETLK, &flock, NULL); loc_wipe (&locker->loc); } @@ -382,7 +387,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, bound_xl->fops->fentrylk, locker->volume, locker->fd, NULL, - ENTRYLK_UNLOCK, ENTRYLK_WRLCK); + ENTRYLK_UNLOCK, ENTRYLK_WRLCK, NULL); fd_unref (locker->fd); } else { gf_log (this->name, GF_LOG_INFO, "entrylk released " @@ -392,7 +397,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, bound_xl->fops->entrylk, locker->volume, &(locker->loc), NULL, - ENTRYLK_UNLOCK, ENTRYLK_WRLCK); + ENTRYLK_UNLOCK, ENTRYLK_WRLCK, NULL); loc_wipe (&locker->loc); } @@ -411,7 +416,7 @@ out: static int server_connection_cleanup_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, dict_t *xdata) { int32_t ret = -1; fd_t *fd = NULL; @@ -484,7 +489,7 @@ do_fd_cleanup (xlator_t *this, server_connection_t *conn, call_frame_t *frame, STACK_WIND (tmp_frame, server_connection_cleanup_flush_cbk, - bound_xl, bound_xl->fops->flush, fd); + bound_xl, bound_xl->fops->flush, fd, NULL); } } diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c index 38ab368c3f0..4992fb53095 100644 --- a/xlators/protocol/server/src/server-resolve.c +++ b/xlators/protocol/server/src/server-resolve.c @@ -70,7 +70,8 @@ resolve_loc_touchup (call_frame_t *frame) int resolve_gfid_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, - struct iatt *buf, dict_t *xattr, struct iatt *postparent) + struct iatt *buf, dict_t *xdata, + struct iatt *postparent) { server_state_t *state = NULL; server_resolve_t *resolve = NULL; @@ -111,7 +112,7 @@ out: int resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, struct iatt *buf, - dict_t *xattr, struct iatt *postparent) + dict_t *xdata, struct iatt *postparent) { server_state_t *state = NULL; server_resolve_t *resolve = NULL; diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h index d000c8d365f..94ceafd10cc 100644 --- a/xlators/protocol/server/src/server.h +++ b/xlators/protocol/server/src/server.h @@ -197,6 +197,9 @@ struct _server_state { struct gf_flock flock; const char *volume; dir_entry_t *entry; + + dict_t *xdata; + mode_t umask; }; extern struct rpcsvc_program gluster_handshake_prog; diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index ef9a98f3854..1c40a12cfd5 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -36,15 +36,13 @@ /* Callback function section */ int server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct statvfs *buf) + int32_t op_ret, int32_t op_errno, struct statvfs *buf, + dict_t *xdata) { gfs3_statfs_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; if (op_ret >= 0) { gf_statfs_from_statfs (&rsp.statfs, buf); @@ -54,16 +52,27 @@ server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_statfs_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct iatt *stbuf, dict_t *dict, + inode_t *inode, struct iatt *stbuf, dict_t *xdata, struct iatt *postparent) { rpcsvc_request_t *req = NULL; @@ -86,19 +95,12 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, server_lookup_cbk, BOUND_XL (frame), BOUND_XL (frame)->fops->lookup, - &fresh_loc, state->dict); + &fresh_loc, state->xdata); loc_wipe (&fresh_loc); return 0; } - if ((op_ret >= 0) && dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, dict, - (&rsp.dict.dict_val), - rsp.dict.dict_len, - op_errno, out); - } - gf_stat_from_iatt (&rsp.postparent, postparent); if (op_ret == 0) { @@ -129,6 +131,10 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } } + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); @@ -145,8 +151,8 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_lookup_rsp); - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -154,16 +160,17 @@ out: int server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct gf_flock *lock) + int32_t op_ret, int32_t op_errno, struct gf_flock *lock, + dict_t *xdata) { gfs3_lk_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; server_state_t *state = NULL; - req = frame->local; + req = frame->local; - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); state = CALL_STATE(frame); @@ -193,16 +200,23 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_lk_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_connection_t *conn = NULL; @@ -211,8 +225,8 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, req = frame->local; - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); conn = SERVER_CONNECTION(frame); state = CALL_STATE(frame); @@ -235,26 +249,30 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_state_t *state = NULL; server_connection_t *conn = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; conn = SERVER_CONNECTION(frame); state = CALL_STATE(frame); @@ -277,25 +295,32 @@ server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { server_connection_t *conn = NULL; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; gf_common_rsp rsp = {0,}; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; conn = SERVER_CONNECTION(frame); state = CALL_STATE(frame); @@ -318,26 +343,33 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_connection_t *conn = NULL; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - + req = frame->local; conn = SERVER_CONNECTION(frame); state = CALL_STATE(frame); if (op_ret >= 0) { @@ -358,27 +390,35 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; server_state_t *state = NULL; - req = frame->local; + req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret) gf_log (this->name, GF_LOG_INFO, "%"PRId64": ACCESS %s (%s) ==> %"PRId32" (%s)", @@ -386,26 +426,33 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_rmdir_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *parent = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -432,9 +479,19 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rmdir_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -442,17 +499,14 @@ int server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_mkdir_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *link_inode = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -471,9 +525,19 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_mkdir_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -481,17 +545,14 @@ int server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_mknod_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *link_inode = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -510,25 +571,31 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_mknod_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); return 0; } int server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -540,22 +607,32 @@ server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) + int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata) { gfs3_readdir_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; int ret = 0; - req = frame->local; + req = frame->local; state = CALL_STATE(frame); if (op_ret > 0) { @@ -563,7 +640,7 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (ret == -1) { op_ret = -1; op_errno = ENOMEM; - goto unwind; + goto out; } } else { /* (op_ret == 0) is valid, and means EOF, don't log for that */ @@ -573,40 +650,28 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->fd ? uuid_utoa (state->fd->inode->gfid) : "--", op_ret, strerror (op_errno)); } -unwind: + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_readdir_rsp); - readdir_rsp_cleanup (&rsp); - - return 0; -} - - -int -server_releasedir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - gf_common_rsp rsp = {0,}; - rpcsvc_request_t *req = NULL; + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - - server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - (xdrproc_t)xdr_gf_common_rsp); + readdir_rsp_cleanup (&rsp); return 0; } int server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd) + int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) { server_connection_t *conn = NULL; server_state_t *state = NULL; @@ -630,21 +695,28 @@ server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } - req = frame->local; + req = frame->local; - rsp.fd = fd_no; + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.fd = fd_no; rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_opendir_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; @@ -653,8 +725,6 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret == -1) gf_log (this->name, GF_LOG_INFO, "%"PRId64": REMOVEXATTR %s (%s) ==> %"PRId32" (%s)", @@ -662,15 +732,25 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; @@ -679,8 +759,6 @@ server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret == -1) gf_log (this->name, GF_LOG_INFO, "%"PRId64": FREMOVEXATTR (%s) ==> %"PRId32" (%s)", @@ -689,15 +767,26 @@ server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--"), op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict) + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) { gfs3_getxattr_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; @@ -711,6 +800,10 @@ server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.dict.dict_len, op_errno, out); } + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: req = frame->local; @@ -729,13 +822,17 @@ out: if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict) + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) { gfs3_fgetxattr_rsp rsp = {0,}; server_state_t *state = NULL; @@ -750,6 +847,9 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_errno, out); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: req = frame->local; @@ -768,12 +868,15 @@ out: if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; @@ -791,26 +894,35 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; server_state_t *state = NULL; - req = frame->local; + req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret == -1) gf_log (this->name, GF_LOG_INFO, @@ -819,9 +931,19 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->fd ? uuid_utoa (state->fd->inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -829,7 +951,8 @@ int server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *stbuf, struct iatt *preoldparent, struct iatt *postoldparent, - struct iatt *prenewparent, struct iatt *postnewparent) + struct iatt *prenewparent, struct iatt *postnewparent, + dict_t *xdata) { gfs3_rename_rsp rsp = {0,}; server_state_t *state = NULL; @@ -837,11 +960,7 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, inode_t *tmp_inode = NULL; inode_t *tmp_parent = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - + req = frame->local; state = CALL_STATE(frame); if (op_ret == 0) { @@ -894,26 +1013,33 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rename_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_unlink_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *parent = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -943,9 +1069,19 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_unlink_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -953,17 +1089,14 @@ int server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_symlink_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *link_inode = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -983,9 +1116,19 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_symlink_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -994,17 +1137,14 @@ int server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_link_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *link_inode = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -1026,25 +1166,32 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_link_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf) + struct iatt *postbuf, dict_t *xdata) { gfs3_truncate_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE (frame); @@ -1059,24 +1206,31 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_truncate_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *stbuf) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf, dict_t *xdata) { gfs3_fstat_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -1090,25 +1244,32 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fstat_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf) + struct iatt *postbuf, dict_t *xdata) { gfs3_ftruncate_rsp rsp = {0}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE (frame); @@ -1123,24 +1284,31 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_ftruncate_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret < 0) { @@ -1151,9 +1319,18 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1161,16 +1338,13 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf) + struct iatt *postbuf, dict_t *xdata) { gfs3_fsync_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -1185,25 +1359,32 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsync_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf) + struct iatt *postbuf, dict_t *xdata) { gfs3_write_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -1217,9 +1398,19 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_write_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -1228,16 +1419,13 @@ int server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iovec *vector, int32_t count, - struct iatt *stbuf, struct iobref *iobref) + struct iatt *stbuf, struct iobref *iobref, dict_t *xdata) { gfs3_read_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -1251,27 +1439,34 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, vector, count, iobref, (xdrproc_t)xdr_gfs3_read_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - uint32_t weak_checksum, uint8_t *strong_checksum) + uint32_t weak_checksum, uint8_t *strong_checksum, dict_t *xdata) { gfs3_rchecksum_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; server_state_t *state = NULL; - req = frame->local; + req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - if (op_ret >= 0) { rsp.weak_checksum = weak_checksum; @@ -1285,16 +1480,26 @@ server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->fd ? uuid_utoa (state->fd->inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rchecksum_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd) + int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) { server_connection_t *conn = NULL; server_state_t *state = NULL; @@ -1317,14 +1522,21 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } - req = frame->local; + req = frame->local; + rsp.fd = fd_no; - rsp.fd = fd_no; + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_open_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -1333,7 +1545,7 @@ int server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, struct iatt *stbuf, - struct iatt *preparent, struct iatt *postparent) + struct iatt *preparent, struct iatt *postparent, dict_t *xdata) { server_connection_t *conn = NULL; server_state_t *state = NULL; @@ -1395,6 +1607,9 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: req = frame->local; @@ -1405,25 +1620,24 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_create_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, const char *buf, - struct iatt *stbuf) + struct iatt *stbuf, dict_t *xdata) { gfs3_readlink_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - + req = frame->local; - state = CALL_STATE(frame); + state = CALL_STATE(frame); if (op_ret >= 0) { gf_stat_from_iatt (&rsp.buf, stbuf); @@ -1439,24 +1653,31 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!rsp.path) rsp.path = ""; + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_readlink_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *stbuf) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf, dict_t *xdata) { gfs3_stat_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE (frame); @@ -1470,9 +1691,19 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_stat_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -1480,18 +1711,14 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct iatt *statpre, struct iatt *statpost) + struct iatt *statpre, struct iatt *statpost, dict_t *xdata) { gfs3_setattr_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - - state = CALL_STATE (frame); + req = frame->local; + state = CALL_STATE (frame); if (op_ret == 0) { gf_stat_from_iatt (&rsp.statpre, statpre); @@ -1504,16 +1731,26 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_setattr_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct iatt *statpre, struct iatt *statpost) + struct iatt *statpre, struct iatt *statpost, dict_t *xdata) { gfs3_fsetattr_rsp rsp = {0,}; server_state_t *state = NULL; @@ -1532,21 +1769,29 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - req = frame->local; + req = frame->local; + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); +out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsetattr_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict) + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) { gfs3_xattrop_rsp rsp = {0,}; server_state_t *state = NULL; @@ -1569,6 +1814,10 @@ server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.dict.dict_len, op_errno, out); } + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: req = frame->local; @@ -1588,13 +1837,17 @@ out: if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict) + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) { gfs3_xattrop_rsp rsp = {0,}; server_state_t *state = NULL; @@ -1617,6 +1870,11 @@ server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.dict.dict_len, op_errno, out); } + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + + out: req = frame->local; @@ -1636,13 +1894,16 @@ out: if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) + int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata) { gfs3_readdirp_rsp rsp = {0,}; server_state_t *state = NULL; @@ -1672,6 +1933,9 @@ server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); @@ -1679,6 +1943,9 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_readdirp_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + readdirp_rsp_cleanup (&rsp); return 0; @@ -1703,11 +1970,12 @@ server_rchecksum_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_rchecksum_cbk, bound_xl, bound_xl->fops->rchecksum, state->fd, - state->offset, state->size); + state->offset, state->size, state->xdata); return 0; err: - server_rchecksum_cbk (frame, NULL, frame->this, op_ret, op_errno, 0, NULL); + server_rchecksum_cbk (frame, NULL, frame->this, op_ret, op_errno, 0, + NULL, NULL); return 0; @@ -1724,13 +1992,13 @@ server_lk_resume (call_frame_t *frame, xlator_t *bound_xl) goto err; STACK_WIND (frame, server_lk_cbk, bound_xl, bound_xl->fops->lk, - state->fd, state->cmd, &state->flock); + state->fd, state->cmd, &state->flock, state->xdata); return 0; err: server_lk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -1757,11 +2025,11 @@ server_rename_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_rename_cbk, bound_xl, bound_xl->fops->rename, - &state->loc, &state->loc2); + &state->loc, &state->loc2, state->xdata); return 0; err: server_rename_cbk (frame, NULL, frame->this, op_ret, op_errno, - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -1790,12 +2058,12 @@ server_link_resume (call_frame_t *frame, xlator_t *bound_xl) state->loc2.inode = inode_ref (state->loc.inode); STACK_WIND (frame, server_link_cbk, bound_xl, bound_xl->fops->link, - &state->loc, &state->loc2); + &state->loc, &state->loc2, state->xdata); return 0; err: server_link_cbk (frame, NULL, frame->this, op_ret, op_errno, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -1813,12 +2081,12 @@ server_symlink_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_symlink_cbk, bound_xl, bound_xl->fops->symlink, - state->name, &state->loc, state->params); + state->name, &state->loc, state->umask, state->xdata); return 0; err: server_symlink_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -1835,11 +2103,11 @@ server_access_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_access_cbk, bound_xl, bound_xl->fops->access, - &state->loc, state->mask); + &state->loc, state->mask, state->xdata); return 0; err: server_access_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1856,12 +2124,12 @@ server_fentrylk_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fentrylk_cbk, bound_xl, bound_xl->fops->fentrylk, state->volume, state->fd, state->name, - state->cmd, state->type); + state->cmd, state->type, state->xdata); return 0; err: server_fentrylk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1879,11 +2147,11 @@ server_entrylk_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_entrylk_cbk, bound_xl, bound_xl->fops->entrylk, state->volume, &state->loc, state->name, - state->cmd, state->type); + state->cmd, state->type, state->xdata); return 0; err: server_entrylk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1899,13 +2167,13 @@ server_finodelk_resume (call_frame_t *frame, xlator_t *bound_xl) goto err; STACK_WIND (frame, server_finodelk_cbk, bound_xl, - bound_xl->fops->finodelk, - state->volume, state->fd, state->cmd, &state->flock); + bound_xl->fops->finodelk, state->volume, state->fd, + state->cmd, &state->flock, state->xdata); return 0; err: server_finodelk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1920,13 +2188,13 @@ server_inodelk_resume (call_frame_t *frame, xlator_t *bound_xl) if (state->resolve.op_ret != 0) goto err; - STACK_WIND (frame, server_inodelk_cbk, - bound_xl, bound_xl->fops->inodelk, - state->volume, &state->loc, state->cmd, &state->flock); + STACK_WIND (frame, server_inodelk_cbk, bound_xl, + bound_xl->fops->inodelk, state->volume, &state->loc, + state->cmd, &state->flock, state->xdata); return 0; err: server_inodelk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1940,12 +2208,12 @@ server_rmdir_resume (call_frame_t *frame, xlator_t *bound_xl) if (state->resolve.op_ret != 0) goto err; - STACK_WIND (frame, server_rmdir_cbk, - bound_xl, bound_xl->fops->rmdir, &state->loc, state->flags); + STACK_WIND (frame, server_rmdir_cbk, bound_xl, bound_xl->fops->rmdir, + &state->loc, state->flags, state->xdata); return 0; err: server_rmdir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -1964,12 +2232,12 @@ server_mkdir_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_mkdir_cbk, bound_xl, bound_xl->fops->mkdir, - &(state->loc), state->mode, state->params); + &(state->loc), state->mode, state->umask, state->xdata); return 0; err: server_mkdir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -1989,12 +2257,12 @@ server_mknod_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_mknod_cbk, bound_xl, bound_xl->fops->mknod, &(state->loc), state->mode, state->dev, - state->params); + state->umask, state->xdata); return 0; err: server_mknod_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -2012,13 +2280,13 @@ server_fsyncdir_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fsyncdir_cbk, bound_xl, bound_xl->fops->fsyncdir, - state->fd, state->flags); + state->fd, state->flags, state->xdata); return 0; err: server_fsyncdir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2036,12 +2304,12 @@ server_readdir_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_readdir_cbk, bound_xl, bound_xl->fops->readdir, - state->fd, state->size, state->offset); + state->fd, state->size, state->offset, state->xdata); return 0; err: server_readdir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2062,7 +2330,7 @@ server_readdirp_resume (call_frame_t *frame, xlator_t *bound_xl) return 0; err: server_readdirp_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2081,11 +2349,11 @@ server_opendir_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_opendir_cbk, bound_xl, bound_xl->fops->opendir, - &state->loc, state->fd); + &state->loc, state->fd, state->xdata); return 0; err: server_opendir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2102,12 +2370,12 @@ server_statfs_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_statfs_cbk, bound_xl, bound_xl->fops->statfs, - &state->loc); + &state->loc, state->xdata); return 0; err: server_statfs_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2124,11 +2392,11 @@ server_removexattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_removexattr_cbk, bound_xl, bound_xl->fops->removexattr, - &state->loc, state->name); + &state->loc, state->name, state->xdata); return 0; err: server_removexattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2144,11 +2412,11 @@ server_fremovexattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fremovexattr_cbk, bound_xl, bound_xl->fops->fremovexattr, - state->fd, state->name); + state->fd, state->name, state->xdata); return 0; err: server_fremovexattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2164,11 +2432,11 @@ server_fgetxattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fgetxattr_cbk, bound_xl, bound_xl->fops->fgetxattr, - state->fd, state->name); + state->fd, state->name, state->xdata); return 0; err: server_fgetxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2185,11 +2453,11 @@ server_xattrop_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_xattrop_cbk, bound_xl, bound_xl->fops->xattrop, - &state->loc, state->flags, state->dict); + &state->loc, state->flags, state->dict, state->xdata); return 0; err: server_xattrop_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2205,11 +2473,11 @@ server_fxattrop_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fxattrop_cbk, bound_xl, bound_xl->fops->fxattrop, - state->fd, state->flags, state->dict); + state->fd, state->flags, state->dict, state->xdata); return 0; err: server_fxattrop_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2225,11 +2493,11 @@ server_fsetxattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_setxattr_cbk, bound_xl, bound_xl->fops->fsetxattr, - state->fd, state->dict, state->flags); + state->fd, state->dict, state->flags, state->xdata); return 0; err: server_fsetxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2246,11 +2514,11 @@ server_unlink_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_unlink_cbk, bound_xl, bound_xl->fops->unlink, - &state->loc); + &state->loc, state->flags, state->xdata); return 0; err: server_unlink_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2266,11 +2534,11 @@ server_truncate_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_truncate_cbk, bound_xl, bound_xl->fops->truncate, - &state->loc, state->offset); + &state->loc, state->offset, state->xdata); return 0; err: server_truncate_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2288,11 +2556,11 @@ server_fstat_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fstat_cbk, bound_xl, bound_xl->fops->fstat, - state->fd); + state->fd, state->xdata); return 0; err: server_fstat_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2309,11 +2577,11 @@ server_setxattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_setxattr_cbk, bound_xl, bound_xl->fops->setxattr, - &state->loc, state->dict, state->flags); + &state->loc, state->dict, state->flags, state->xdata); return 0; err: server_setxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2331,11 +2599,11 @@ server_getxattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_getxattr_cbk, bound_xl, bound_xl->fops->getxattr, - &state->loc, state->name); + &state->loc, state->name, state->xdata); return 0; err: server_getxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2352,11 +2620,11 @@ server_ftruncate_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_ftruncate_cbk, bound_xl, bound_xl->fops->ftruncate, - state->fd, state->offset); + state->fd, state->offset, state->xdata); return 0; err: server_ftruncate_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2373,11 +2641,11 @@ server_flush_resume (call_frame_t *frame, xlator_t *bound_xl) goto err; STACK_WIND (frame, server_flush_cbk, - bound_xl, bound_xl->fops->flush, state->fd); + bound_xl, bound_xl->fops->flush, state->fd, state->xdata); return 0; err: server_flush_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2395,11 +2663,11 @@ server_fsync_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fsync_cbk, bound_xl, bound_xl->fops->fsync, - state->fd, state->flags); + state->fd, state->flags, state->xdata); return 0; err: server_fsync_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2417,12 +2685,12 @@ server_writev_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_writev_cbk, bound_xl, bound_xl->fops->writev, state->fd, state->payload_vector, state->payload_count, - state->offset, state->flags, state->iobref); + state->offset, state->flags, state->iobref, state->xdata); return 0; err: server_writev_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2439,12 +2707,12 @@ server_readv_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_readv_cbk, bound_xl, bound_xl->fops->readv, - state->fd, state->size, state->offset, state->flags); + state->fd, state->size, state->offset, state->flags, state->xdata); return 0; err: server_readv_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, 0, NULL, NULL); + state->resolve.op_errno, NULL, 0, NULL, NULL, NULL); return 0; } @@ -2475,13 +2743,13 @@ server_create_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_create_cbk, bound_xl, bound_xl->fops->create, &(state->loc), state->flags, state->mode, - state->fd, state->params); + state->umask, state->fd, state->xdata); return 0; err: server_create_cbk (frame, NULL, frame->this, state->resolve.op_ret, state->resolve.op_errno, NULL, NULL, NULL, - NULL, NULL); + NULL, NULL, NULL); return 0; } @@ -2501,12 +2769,12 @@ server_open_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_open_cbk, bound_xl, bound_xl->fops->open, - &state->loc, state->flags, state->fd, 0); + &state->loc, state->flags, state->fd, state->xdata); return 0; err: server_open_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2523,11 +2791,11 @@ server_readlink_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_readlink_cbk, bound_xl, bound_xl->fops->readlink, - &state->loc, state->size); + &state->loc, state->size, state->xdata); return 0; err: server_readlink_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2544,11 +2812,11 @@ server_fsetattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fsetattr_cbk, bound_xl, bound_xl->fops->fsetattr, - state->fd, &state->stbuf, state->valid); + state->fd, &state->stbuf, state->valid, state->xdata); return 0; err: server_fsetattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2566,11 +2834,11 @@ server_setattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_setattr_cbk, bound_xl, bound_xl->fops->setattr, - &state->loc, &state->stbuf, state->valid); + &state->loc, &state->stbuf, state->valid, state->xdata); return 0; err: server_setattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2587,11 +2855,11 @@ server_stat_resume (call_frame_t *frame, xlator_t *bound_xl) goto err; STACK_WIND (frame, server_stat_cbk, - bound_xl, bound_xl->fops->stat, &state->loc); + bound_xl, bound_xl->fops->stat, &state->loc, state->xdata); return 0; err: server_stat_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2612,7 +2880,7 @@ server_lookup_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_lookup_cbk, bound_xl, bound_xl->fops->lookup, - &state->loc, state->dict); + &state->loc, state->xdata); return 0; err: @@ -2630,10 +2898,11 @@ err: int server_stat (rpcsvc_request_t *req) { - server_state_t *state = NULL; - call_frame_t *frame = NULL; - gfs3_stat_req args = {{0,},}; - int ret = -1; + server_state_t *state = NULL; + call_frame_t *frame = NULL; + gfs3_stat_req args = {{0,},}; + int ret = -1; + int op_errno = 0; if (!req) return 0; @@ -2664,9 +2933,22 @@ server_stat (rpcsvc_request_t *req) state->resolve.type = RESOLVE_MUST; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + + ret = 0; resolve_and_resume (frame, server_stat_resume); + out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -2678,6 +2960,7 @@ server_setattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_setattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return 0; @@ -2709,9 +2992,21 @@ server_setattr (rpcsvc_request_t *req) gf_stat_to_iatt (&args.stbuf, &state->stbuf); state->valid = args.valid; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_setattr_resume); + out: + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + return ret; } @@ -2723,6 +3018,7 @@ server_fsetattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fsetattr_req args = {0,}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -2754,9 +3050,21 @@ server_fsetattr (rpcsvc_request_t *req) gf_stat_to_iatt (&args.stbuf, &state->stbuf); state->valid = args.valid; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fsetattr_resume); + out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -2768,6 +3076,7 @@ server_readlink (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_readlink_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -2798,9 +3107,21 @@ server_readlink (rpcsvc_request_t *req) state->size = args.size; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_readlink_resume); + out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -2810,7 +3131,6 @@ server_create (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - dict_t *params = NULL; gfs3_create_req args = {{0,},}; int ret = -1; int op_errno = 0; @@ -2841,16 +3161,10 @@ server_create (rpcsvc_request_t *req) goto out; } - /* Unserialize the dictionary */ - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, params, - (args.dict.dict_val), - (args.dict.dict_len), ret, - op_errno, out); - - state->params = params; state->resolve.bname = gf_strdup (args.bname); state->mode = args.mode; + state->umask = args.umask; state->flags = gf_flags_to_flags (args.flags); memcpy (state->resolve.pargfid, args.pargfid, 16); @@ -2860,27 +3174,23 @@ server_create (rpcsvc_request_t *req) state->resolve.type = RESOLVE_DONTCARE; } + /* TODO: can do alloca for xdata field instead of stdalloc */ + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_create_resume); +out: /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); - return ret; -out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (params) - dict_unref (params); - - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } - return ret; } @@ -2892,6 +3202,7 @@ server_open (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_open_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -2922,9 +3233,20 @@ server_open (rpcsvc_request_t *req) state->flags = gf_flags_to_flags (args.flags); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_open_resume); out: + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + return ret; } @@ -2936,6 +3258,7 @@ server_readv (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_read_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) goto out; @@ -2969,9 +3292,21 @@ server_readv (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_readv_resume); out: + /* memory allocated by libc, don't use GF_FREE */ + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -2985,6 +3320,7 @@ server_writev (rpcsvc_request_t *req) ssize_t len = 0; int i = 0; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3035,9 +3371,20 @@ server_writev (rpcsvc_request_t *req) state->size += state->payload_vector[i].iov_len; } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_writev_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3093,6 +3440,7 @@ server_release (rpcsvc_request_t *req) server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + ret = 0; out: return ret; @@ -3117,6 +3465,7 @@ server_releasedir (rpcsvc_request_t *req) server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + ret = 0; out: return ret; @@ -3130,6 +3479,7 @@ server_fsync (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fsync_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3160,9 +3510,20 @@ server_fsync (rpcsvc_request_t *req) state->flags = args.data; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fsync_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3175,6 +3536,7 @@ server_flush (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_flush_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3204,9 +3566,20 @@ server_flush (rpcsvc_request_t *req) state->resolve.fd_no = args.fd; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_flush_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3219,6 +3592,7 @@ server_ftruncate (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_ftruncate_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3249,9 +3623,20 @@ server_ftruncate (rpcsvc_request_t *req) state->offset = args.offset; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_ftruncate_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3261,8 +3646,9 @@ server_fstat (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - gfs3_write_req args = {{0,},}; + gfs3_fstat_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3292,9 +3678,20 @@ server_fstat (rpcsvc_request_t *req) state->resolve.fd_no = args.fd; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fstat_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3306,6 +3703,7 @@ server_truncate (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_truncate_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3335,9 +3733,20 @@ server_truncate (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); state->offset = args.offset; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_truncate_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3350,6 +3759,7 @@ server_unlink (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_unlink_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3381,9 +3791,22 @@ server_unlink (rpcsvc_request_t *req) state->resolve.bname = gf_strdup (args.bname); memcpy (state->resolve.pargfid, args.pargfid, 16); + state->flags = args.xflags; + + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_unlink_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3397,7 +3820,7 @@ server_setxattr (rpcsvc_request_t *req) server_connection_t *conn = NULL; gfs3_setxattr_req args = {{0,},}; int32_t ret = -1; - int op_errno = 0; + int32_t op_errno = 0; if (!req) return ret; @@ -3441,17 +3864,25 @@ server_setxattr (rpcsvc_request_t *req) /* There can be some commands hidden in key, check and proceed */ gf_server_check_setxattr_cmd (frame, dict); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_setxattr_resume); return ret; out: - if (dict) - dict_unref (dict); + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; + if (dict) + dict_unref (dict); + return ret; } @@ -3466,7 +3897,7 @@ server_fsetxattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fsetxattr_req args = {{0,},}; int32_t ret = -1; - int op_errno = 0; + int32_t op_errno = 0; if (!req) return ret; @@ -3507,15 +3938,25 @@ server_fsetxattr (rpcsvc_request_t *req) state->dict = dict; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fsetxattr_resume); return ret; out: - if (dict) - dict_unref (dict); + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + if (op_errno) req->rpc_err = GARBAGE_ARGS; + + if (dict) + dict_unref (dict); + return ret; } @@ -3530,7 +3971,7 @@ server_fxattrop (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fxattrop_req args = {{0,},}; int32_t ret = -1; - int op_errno = 0; + int32_t op_errno = 0; if (!req) return ret; @@ -3571,17 +4012,26 @@ server_fxattrop (rpcsvc_request_t *req) state->dict = dict; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fxattrop_resume); return ret; out: - if (dict) - dict_unref (dict); + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + if (op_errno) req->rpc_err = GARBAGE_ARGS; + if (dict) + dict_unref (dict); + return ret; } @@ -3596,7 +4046,7 @@ server_xattrop (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_xattrop_req args = {{0,},}; int32_t ret = -1; - int op_errno = 0; + int32_t op_errno = 0; if (!req) return ret; @@ -3637,17 +4087,25 @@ server_xattrop (rpcsvc_request_t *req) state->dict = dict; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_xattrop_resume); return ret; out: - if (dict) - dict_unref (dict); + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; + if (dict) + dict_unref (dict); + return ret; } @@ -3659,6 +4117,7 @@ server_getxattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_getxattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3695,9 +4154,20 @@ server_getxattr (rpcsvc_request_t *req) gf_server_check_getxattr_cmd (frame, state->name); } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_getxattr_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3709,6 +4179,7 @@ server_fgetxattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fgetxattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3742,9 +4213,20 @@ server_fgetxattr (rpcsvc_request_t *req) if (args.namelen) state->name = gf_strdup (args.name); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fgetxattr_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3757,6 +4239,7 @@ server_removexattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_removexattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3788,9 +4271,20 @@ server_removexattr (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); state->name = gf_strdup (args.name); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_removexattr_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3801,6 +4295,7 @@ server_fremovexattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fremovexattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3834,9 +4329,20 @@ server_fremovexattr (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); state->name = gf_strdup (args.name); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fremovexattr_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3850,6 +4356,7 @@ server_opendir (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_opendir_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3878,9 +4385,20 @@ server_opendir (rpcsvc_request_t *req) state->resolve.type = RESOLVE_MUST; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_opendir_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3893,7 +4411,7 @@ server_readdirp (rpcsvc_request_t *req) gfs3_readdirp_req args = {{0,},}; size_t headers_size = 0; int ret = -1; - int op_errno = 0; + int op_errno = 0; if (!req) return ret; @@ -3935,6 +4453,7 @@ server_readdirp (rpcsvc_request_t *req) state->offset = args.offset; memcpy (state->resolve.gfid, args.gfid, 16); + /* here, dict itself works as xdata */ GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->dict, (args.dict.dict_val), (args.dict.dict_len), ret, @@ -3947,9 +4466,8 @@ out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (args.dict.dict_val != NULL) { + if (args.dict.dict_val) free (args.dict.dict_val); - } return ret; } @@ -3962,6 +4480,7 @@ server_readdir (rpcsvc_request_t *req) gfs3_readdir_req args = {{0,},}; size_t headers_size = 0; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4003,9 +4522,20 @@ server_readdir (rpcsvc_request_t *req) state->offset = args.offset; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_readdir_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4016,6 +4546,7 @@ server_fsyncdir (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fsyncdir_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4046,9 +4577,20 @@ server_fsyncdir (rpcsvc_request_t *req) state->flags = args.data; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fsyncdir_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4059,10 +4601,9 @@ server_mknod (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - dict_t *params = NULL; gfs3_mknod_req args = {{0,},}; int ret = -1; - int op_errno = 0; + int op_errno = 0; if (!req) return ret; @@ -4090,40 +4631,29 @@ server_mknod (rpcsvc_request_t *req) goto out; } - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, params, - (args.dict.dict_val), - (args.dict.dict_len), ret, - op_errno, out); - - state->params = params; - state->resolve.type = RESOLVE_NOT; memcpy (state->resolve.pargfid, args.pargfid, 16); state->resolve.bname = gf_strdup (args.bname); - state->mode = args.mode; - state->dev = args.dev; + state->mode = args.mode; + state->dev = args.dev; + state->umask = args.umask; + + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); ret = 0; resolve_and_resume (frame, server_mknod_resume); - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } - - return ret; out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (params) - dict_unref (params); - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); return ret; @@ -4135,10 +4665,9 @@ server_mkdir (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - dict_t *params = NULL; gfs3_mkdir_req args = {{0,},}; int ret = -1; - int op_errno = 0; + int op_errno = 0; if (!req) return ret; @@ -4165,39 +4694,29 @@ server_mkdir (rpcsvc_request_t *req) req->rpc_err = GARBAGE_ARGS; goto out; } - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, params, - (args.dict.dict_val), - (args.dict.dict_len), ret, - op_errno, out); - - state->params = params; state->resolve.type = RESOLVE_NOT; memcpy (state->resolve.pargfid, args.pargfid, 16); state->resolve.bname = gf_strdup (args.bname); - state->mode = args.mode; + state->mode = args.mode; + state->umask = args.umask; + + /* TODO: can do alloca for xdata field instead of stdalloc */ + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); ret = 0; resolve_and_resume (frame, server_mkdir_resume); - if (args.dict.dict_val != NULL) { - /* memory allocated by libc, don't use GF_FREE */ - free (args.dict.dict_val); - } - - return ret; out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (params) - dict_unref (params); - - if (args.dict.dict_val != NULL) { - /* memory allocated by libc, don't use GF_FREE */ - free (args.dict.dict_val); - } + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); return ret; } @@ -4210,6 +4729,7 @@ server_rmdir (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_rmdir_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4241,11 +4761,22 @@ server_rmdir (rpcsvc_request_t *req) memcpy (state->resolve.pargfid, args.pargfid, 16); state->resolve.bname = gf_strdup (args.bname); - state->flags = args.flags; + state->flags = args.xflags; + + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); ret = 0; resolve_and_resume (frame, server_rmdir_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4259,6 +4790,7 @@ server_inodelk (rpcsvc_request_t *req) gfs3_inodelk_req args = {{0,},}; int cmd = 0; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4319,9 +4851,20 @@ server_inodelk (rpcsvc_request_t *req) break; } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_inodelk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4332,6 +4875,7 @@ server_finodelk (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_finodelk_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4392,9 +4936,20 @@ server_finodelk (rpcsvc_request_t *req) break; } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_finodelk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4406,6 +4961,7 @@ server_entrylk (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_entrylk_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4444,9 +5000,20 @@ server_entrylk (rpcsvc_request_t *req) state->cmd = args.cmd; state->type = args.type; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_entrylk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4457,6 +5024,7 @@ server_fentrylk (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fentrylk_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4495,9 +5063,20 @@ server_fentrylk (rpcsvc_request_t *req) state->name = gf_strdup (args.name); state->volume = gf_strdup (args.volume); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fentrylk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4508,6 +5087,7 @@ server_access (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_access_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4537,9 +5117,20 @@ server_access (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); state->mask = args.mask; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_access_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4550,10 +5141,9 @@ server_symlink (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - dict_t *params = NULL; gfs3_symlink_req args = {{0,},}; int ret = -1; - int op_errno = 0; + int op_errno = 0; if (!req) return ret; @@ -4582,37 +5172,27 @@ server_symlink (rpcsvc_request_t *req) goto out; } - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, params, - (args.dict.dict_val), - (args.dict.dict_len), ret, - op_errno, out); - - state->params = params; - state->resolve.type = RESOLVE_NOT; memcpy (state->resolve.pargfid, args.pargfid, 16); state->resolve.bname = gf_strdup (args.bname); state->name = gf_strdup (args.linkname); + state->umask = args.umask; + + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); ret = 0; resolve_and_resume (frame, server_symlink_resume); - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } - return ret; out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (params) - dict_unref (params); - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); return ret; } @@ -4626,6 +5206,7 @@ server_link (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_link_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4660,9 +5241,20 @@ server_link (rpcsvc_request_t *req) state->resolve2.bname = gf_strdup (args.newbname); memcpy (state->resolve2.pargfid, args.newgfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_link_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4674,6 +5266,7 @@ server_rename (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_rename_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4710,9 +5303,20 @@ server_rename (rpcsvc_request_t *req) state->resolve2.bname = gf_strdup (args.newbname); memcpy (state->resolve2.pargfid, args.newgfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_rename_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4724,6 +5328,7 @@ server_lk (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_lk_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4803,9 +5408,20 @@ server_lk (rpcsvc_request_t *req) } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_lk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4817,6 +5433,7 @@ server_rchecksum (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_rchecksum_req args = {0,}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4847,9 +5464,20 @@ server_rchecksum (rpcsvc_request_t *req) state->offset = args.offset; state->size = args.len; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_rchecksum_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4870,20 +5498,19 @@ server_null (rpcsvc_request_t *req) int server_lookup (rpcsvc_request_t *req) { - call_frame_t *frame = NULL; - server_connection_t *conn = NULL; - server_state_t *state = NULL; - dict_t *xattr_req = NULL; - gfs3_lookup_req args = {{0,},}; - int ret = -1; - int op_errno = 0; + call_frame_t *frame = NULL; + server_connection_t *conn = NULL; + server_state_t *state = NULL; + gfs3_lookup_req args = {{0,},}; + int ret = -1; + int op_errno = 0; GF_VALIDATE_OR_GOTO ("server", req, err); conn = req->trans->xl_private; - args.bname = alloca (req->msg[0].iov_len); - args.dict.dict_val = alloca (req->msg[0].iov_len); + args.bname = alloca (req->msg[0].iov_len); + args.xdata.xdata_val = alloca (req->msg[0].iov_len); if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_lookup_req)) { //failed to decode msg; @@ -4919,19 +5546,16 @@ server_lookup (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); } - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, xattr_req, - (args.dict.dict_val), - (args.dict.dict_len), ret, + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, op_errno, out); - state->dict = xattr_req; ret = 0; resolve_and_resume (frame, server_lookup_resume); return ret; out: - if (xattr_req) - dict_unref (xattr_req); server_lookup_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL, NULL, NULL); @@ -4946,7 +5570,8 @@ server_statfs (rpcsvc_request_t *req) server_state_t *state = NULL; call_frame_t *frame = NULL; gfs3_statfs_req args = {{0,},}; - int ret = -1; + int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4975,9 +5600,17 @@ server_statfs (rpcsvc_request_t *req) state->resolve.type = RESOLVE_MUST; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_statfs_resume); out: + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } |