From 9d3af972f516b6ba38d2736ce2016e34a452d569 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 20 Mar 2012 17:22:24 +0530 Subject: 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 BUG: 782265 Reviewed-on: http://review.gluster.com/2960 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/protocol/client/src/client-handshake.c | 1 - xlators/protocol/client/src/client-lk.c | 14 +- xlators/protocol/client/src/client.c | 233 +++-- xlators/protocol/client/src/client.h | 6 +- xlators/protocol/client/src/client3_1-fops.c | 1237 +++++++++++++++++++----- 5 files changed, 1139 insertions(+), 352 deletions(-) (limited to 'xlators/protocol/client/src') 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; } -- cgit