diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-03-20 17:22:24 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-03-22 16:40:27 -0700 |
commit | 9d3af972f516b6ba38d2736ce2016e34a452d569 (patch) | |
tree | 1dcdc620748a42cdfb5464c3adaae5a4a3a6f869 /xlators/protocol/server | |
parent | afe542eca18888463798747d2a95e5a9d239a4a0 (diff) |
core: adding extra data for fops
with this change, the xlator APIs will have a dictionary as extra
argument, which is passed between all the layers. This can be
utilized for overloading in some of the operations.
Change-Id: I58a8186b3ef647650280e63f3e5e9b9de7827b40
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 782265
Reviewed-on: http://review.gluster.com/2960
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/protocol/server')
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 19 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-resolve.c | 5 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.h | 3 | ||||
-rw-r--r-- | xlators/protocol/server/src/server3_1-fops.c | 1429 |
4 files changed, 1049 insertions, 407 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index adcf9c1f1..7ccd629e7 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -116,6 +116,11 @@ free_state (server_state_t *state) state->dict = NULL; } + if (state->xdata) { + dict_unref (state->xdata); + state->xdata = NULL; + } + if (state->volume) GF_FREE ((void *)state->volume); @@ -249,7 +254,7 @@ out: static int server_nop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { int ret = -1; server_state_t *state = NULL; @@ -334,7 +339,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, STACK_WIND (tmp_frame, server_nop_cbk, bound_xl, bound_xl->fops->finodelk, locker->volume, - locker->fd, F_SETLK, &flock); + locker->fd, F_SETLK, &flock, NULL); fd_unref (locker->fd); } else { gf_log (this->name, GF_LOG_INFO, "inodelk released " @@ -343,7 +348,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, STACK_WIND (tmp_frame, server_nop_cbk, bound_xl, bound_xl->fops->inodelk, locker->volume, - &(locker->loc), F_SETLK, &flock); + &(locker->loc), F_SETLK, &flock, NULL); loc_wipe (&locker->loc); } @@ -382,7 +387,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, bound_xl->fops->fentrylk, locker->volume, locker->fd, NULL, - ENTRYLK_UNLOCK, ENTRYLK_WRLCK); + ENTRYLK_UNLOCK, ENTRYLK_WRLCK, NULL); fd_unref (locker->fd); } else { gf_log (this->name, GF_LOG_INFO, "entrylk released " @@ -392,7 +397,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, bound_xl->fops->entrylk, locker->volume, &(locker->loc), NULL, - ENTRYLK_UNLOCK, ENTRYLK_WRLCK); + ENTRYLK_UNLOCK, ENTRYLK_WRLCK, NULL); loc_wipe (&locker->loc); } @@ -411,7 +416,7 @@ out: static int server_connection_cleanup_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, dict_t *xdata) { int32_t ret = -1; fd_t *fd = NULL; @@ -484,7 +489,7 @@ do_fd_cleanup (xlator_t *this, server_connection_t *conn, call_frame_t *frame, STACK_WIND (tmp_frame, server_connection_cleanup_flush_cbk, - bound_xl, bound_xl->fops->flush, fd); + bound_xl, bound_xl->fops->flush, fd, NULL); } } diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c index 38ab368c3..4992fb530 100644 --- a/xlators/protocol/server/src/server-resolve.c +++ b/xlators/protocol/server/src/server-resolve.c @@ -70,7 +70,8 @@ resolve_loc_touchup (call_frame_t *frame) int resolve_gfid_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, - struct iatt *buf, dict_t *xattr, struct iatt *postparent) + struct iatt *buf, dict_t *xdata, + struct iatt *postparent) { server_state_t *state = NULL; server_resolve_t *resolve = NULL; @@ -111,7 +112,7 @@ out: int resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, struct iatt *buf, - dict_t *xattr, struct iatt *postparent) + dict_t *xdata, struct iatt *postparent) { server_state_t *state = NULL; server_resolve_t *resolve = NULL; diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h index d000c8d36..94ceafd10 100644 --- a/xlators/protocol/server/src/server.h +++ b/xlators/protocol/server/src/server.h @@ -197,6 +197,9 @@ struct _server_state { struct gf_flock flock; const char *volume; dir_entry_t *entry; + + dict_t *xdata; + mode_t umask; }; extern struct rpcsvc_program gluster_handshake_prog; diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index ef9a98f38..1c40a12cf 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -36,15 +36,13 @@ /* Callback function section */ int server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct statvfs *buf) + int32_t op_ret, int32_t op_errno, struct statvfs *buf, + dict_t *xdata) { gfs3_statfs_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; if (op_ret >= 0) { gf_statfs_from_statfs (&rsp.statfs, buf); @@ -54,16 +52,27 @@ server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_statfs_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct iatt *stbuf, dict_t *dict, + inode_t *inode, struct iatt *stbuf, dict_t *xdata, struct iatt *postparent) { rpcsvc_request_t *req = NULL; @@ -86,19 +95,12 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_WIND (frame, server_lookup_cbk, BOUND_XL (frame), BOUND_XL (frame)->fops->lookup, - &fresh_loc, state->dict); + &fresh_loc, state->xdata); loc_wipe (&fresh_loc); return 0; } - if ((op_ret >= 0) && dict) { - GF_PROTOCOL_DICT_SERIALIZE (this, dict, - (&rsp.dict.dict_val), - rsp.dict.dict_len, - op_errno, out); - } - gf_stat_from_iatt (&rsp.postparent, postparent); if (op_ret == 0) { @@ -129,6 +131,10 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } } + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); @@ -145,8 +151,8 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_lookup_rsp); - if (rsp.dict.dict_val) - GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -154,16 +160,17 @@ out: int server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct gf_flock *lock) + int32_t op_ret, int32_t op_errno, struct gf_flock *lock, + dict_t *xdata) { gfs3_lk_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; server_state_t *state = NULL; - req = frame->local; + req = frame->local; - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); state = CALL_STATE(frame); @@ -193,16 +200,23 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_lk_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_connection_t *conn = NULL; @@ -211,8 +225,8 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, req = frame->local; - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); conn = SERVER_CONNECTION(frame); state = CALL_STATE(frame); @@ -235,26 +249,30 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_state_t *state = NULL; server_connection_t *conn = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; conn = SERVER_CONNECTION(frame); state = CALL_STATE(frame); @@ -277,25 +295,32 @@ server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { server_connection_t *conn = NULL; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; gf_common_rsp rsp = {0,}; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; conn = SERVER_CONNECTION(frame); state = CALL_STATE(frame); @@ -318,26 +343,33 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_connection_t *conn = NULL; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - + req = frame->local; conn = SERVER_CONNECTION(frame); state = CALL_STATE(frame); if (op_ret >= 0) { @@ -358,27 +390,35 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; server_state_t *state = NULL; - req = frame->local; + req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret) gf_log (this->name, GF_LOG_INFO, "%"PRId64": ACCESS %s (%s) ==> %"PRId32" (%s)", @@ -386,26 +426,33 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_rmdir_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *parent = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -432,9 +479,19 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rmdir_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -442,17 +499,14 @@ int server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_mkdir_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *link_inode = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -471,9 +525,19 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_mkdir_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -481,17 +545,14 @@ int server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_mknod_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *link_inode = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -510,25 +571,31 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_mknod_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); return 0; } int server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -540,22 +607,32 @@ server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) + int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata) { gfs3_readdir_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; int ret = 0; - req = frame->local; + req = frame->local; state = CALL_STATE(frame); if (op_ret > 0) { @@ -563,7 +640,7 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (ret == -1) { op_ret = -1; op_errno = ENOMEM; - goto unwind; + goto out; } } else { /* (op_ret == 0) is valid, and means EOF, don't log for that */ @@ -573,40 +650,28 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->fd ? uuid_utoa (state->fd->inode->gfid) : "--", op_ret, strerror (op_errno)); } -unwind: + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_readdir_rsp); - readdir_rsp_cleanup (&rsp); - - return 0; -} - - -int -server_releasedir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - gf_common_rsp rsp = {0,}; - rpcsvc_request_t *req = NULL; + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - - server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - (xdrproc_t)xdr_gf_common_rsp); + readdir_rsp_cleanup (&rsp); return 0; } int server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd) + int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) { server_connection_t *conn = NULL; server_state_t *state = NULL; @@ -630,21 +695,28 @@ server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } - req = frame->local; + req = frame->local; - rsp.fd = fd_no; + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.fd = fd_no; rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_opendir_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; @@ -653,8 +725,6 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret == -1) gf_log (this->name, GF_LOG_INFO, "%"PRId64": REMOVEXATTR %s (%s) ==> %"PRId32" (%s)", @@ -662,15 +732,25 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; @@ -679,8 +759,6 @@ server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret == -1) gf_log (this->name, GF_LOG_INFO, "%"PRId64": FREMOVEXATTR (%s) ==> %"PRId32" (%s)", @@ -689,15 +767,26 @@ server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--"), op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict) + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) { gfs3_getxattr_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; @@ -711,6 +800,10 @@ server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.dict.dict_len, op_errno, out); } + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: req = frame->local; @@ -729,13 +822,17 @@ out: if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict) + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) { gfs3_fgetxattr_rsp rsp = {0,}; server_state_t *state = NULL; @@ -750,6 +847,9 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_errno, out); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: req = frame->local; @@ -768,12 +868,15 @@ out: if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; @@ -791,26 +894,35 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, frame->root->unique, state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; server_state_t *state = NULL; - req = frame->local; + req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret == -1) gf_log (this->name, GF_LOG_INFO, @@ -819,9 +931,19 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->fd ? uuid_utoa (state->fd->inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -829,7 +951,8 @@ int server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *stbuf, struct iatt *preoldparent, struct iatt *postoldparent, - struct iatt *prenewparent, struct iatt *postnewparent) + struct iatt *prenewparent, struct iatt *postnewparent, + dict_t *xdata) { gfs3_rename_rsp rsp = {0,}; server_state_t *state = NULL; @@ -837,11 +960,7 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, inode_t *tmp_inode = NULL; inode_t *tmp_parent = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - + req = frame->local; state = CALL_STATE(frame); if (op_ret == 0) { @@ -894,26 +1013,33 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rename_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_unlink_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *parent = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -943,9 +1069,19 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_unlink_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -953,17 +1089,14 @@ int server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_symlink_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *link_inode = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -983,9 +1116,19 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_symlink_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -994,17 +1137,14 @@ int server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent) + struct iatt *postparent, dict_t *xdata) { gfs3_link_rsp rsp = {0,}; server_state_t *state = NULL; inode_t *link_inode = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -1026,25 +1166,32 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_link_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf) + struct iatt *postbuf, dict_t *xdata) { gfs3_truncate_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE (frame); @@ -1059,24 +1206,31 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_truncate_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *stbuf) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf, dict_t *xdata) { gfs3_fstat_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -1090,25 +1244,32 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fstat_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf) + struct iatt *postbuf, dict_t *xdata) { gfs3_ftruncate_rsp rsp = {0}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE (frame); @@ -1123,24 +1284,31 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_ftruncate_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, dict_t *xdata) { gf_common_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret < 0) { @@ -1151,9 +1319,18 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); return 0; } @@ -1161,16 +1338,13 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf) + struct iatt *postbuf, dict_t *xdata) { gfs3_fsync_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); @@ -1185,25 +1359,32 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsync_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf) + struct iatt *postbuf, dict_t *xdata) { gfs3_write_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -1217,9 +1398,19 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_write_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -1228,16 +1419,13 @@ int server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iovec *vector, int32_t count, - struct iatt *stbuf, struct iobref *iobref) + struct iatt *stbuf, struct iobref *iobref, dict_t *xdata) { gfs3_read_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE(frame); if (op_ret >= 0) { @@ -1251,27 +1439,34 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, vector, count, iobref, (xdrproc_t)xdr_gfs3_read_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - uint32_t weak_checksum, uint8_t *strong_checksum) + uint32_t weak_checksum, uint8_t *strong_checksum, dict_t *xdata) { gfs3_rchecksum_rsp rsp = {0,}; rpcsvc_request_t *req = NULL; server_state_t *state = NULL; - req = frame->local; + req = frame->local; state = CALL_STATE(frame); - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - if (op_ret >= 0) { rsp.weak_checksum = weak_checksum; @@ -1285,16 +1480,26 @@ server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->fd ? uuid_utoa (state->fd->inode->gfid) : "--", op_ret, strerror (op_errno)); + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_rchecksum_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd) + int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) { server_connection_t *conn = NULL; server_state_t *state = NULL; @@ -1317,14 +1522,21 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } - req = frame->local; + req = frame->local; + rsp.fd = fd_no; - rsp.fd = fd_no; + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_open_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -1333,7 +1545,7 @@ int server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, struct iatt *stbuf, - struct iatt *preparent, struct iatt *postparent) + struct iatt *preparent, struct iatt *postparent, dict_t *xdata) { server_connection_t *conn = NULL; server_state_t *state = NULL; @@ -1395,6 +1607,9 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: req = frame->local; @@ -1405,25 +1620,24 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_create_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, const char *buf, - struct iatt *stbuf) + struct iatt *stbuf, dict_t *xdata) { gfs3_readlink_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - + req = frame->local; - state = CALL_STATE(frame); + state = CALL_STATE(frame); if (op_ret >= 0) { gf_stat_from_iatt (&rsp.buf, stbuf); @@ -1439,24 +1653,31 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (!rsp.path) rsp.path = ""; + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_readlink_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *stbuf) + int32_t op_ret, int32_t op_errno, struct iatt *stbuf, dict_t *xdata) { gfs3_stat_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); + req = frame->local; state = CALL_STATE (frame); @@ -1470,9 +1691,19 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_stat_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } @@ -1480,18 +1711,14 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct iatt *statpre, struct iatt *statpost) + struct iatt *statpre, struct iatt *statpost, dict_t *xdata) { gfs3_setattr_rsp rsp = {0,}; server_state_t *state = NULL; rpcsvc_request_t *req = NULL; - req = frame->local; - - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - - state = CALL_STATE (frame); + req = frame->local; + state = CALL_STATE (frame); if (op_ret == 0) { gf_stat_from_iatt (&rsp.statpre, statpre); @@ -1504,16 +1731,26 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "--", op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + +out: + rsp.op_ret = op_ret; + rsp.op_errno = gf_errno_to_error (op_errno); + server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_setattr_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct iatt *statpre, struct iatt *statpost) + struct iatt *statpre, struct iatt *statpost, dict_t *xdata) { gfs3_fsetattr_rsp rsp = {0,}; server_state_t *state = NULL; @@ -1532,21 +1769,29 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - req = frame->local; + req = frame->local; + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); +out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_fsetattr_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict) + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) { gfs3_xattrop_rsp rsp = {0,}; server_state_t *state = NULL; @@ -1569,6 +1814,10 @@ server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.dict.dict_len, op_errno, out); } + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: req = frame->local; @@ -1588,13 +1837,17 @@ out: if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict) + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata) { gfs3_xattrop_rsp rsp = {0,}; server_state_t *state = NULL; @@ -1617,6 +1870,11 @@ server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.dict.dict_len, op_errno, out); } + + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + + out: req = frame->local; @@ -1636,13 +1894,16 @@ out: if (rsp.dict.dict_val) GF_FREE (rsp.dict.dict_val); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + return 0; } int server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) + int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata) { gfs3_readdirp_rsp rsp = {0,}; server_state_t *state = NULL; @@ -1672,6 +1933,9 @@ server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } + GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), + rsp.xdata.xdata_len, op_errno, out); + out: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); @@ -1679,6 +1943,9 @@ out: server_submit_reply (frame, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gfs3_readdirp_rsp); + if (rsp.xdata.xdata_val) + GF_FREE (rsp.xdata.xdata_val); + readdirp_rsp_cleanup (&rsp); return 0; @@ -1703,11 +1970,12 @@ server_rchecksum_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_rchecksum_cbk, bound_xl, bound_xl->fops->rchecksum, state->fd, - state->offset, state->size); + state->offset, state->size, state->xdata); return 0; err: - server_rchecksum_cbk (frame, NULL, frame->this, op_ret, op_errno, 0, NULL); + server_rchecksum_cbk (frame, NULL, frame->this, op_ret, op_errno, 0, + NULL, NULL); return 0; @@ -1724,13 +1992,13 @@ server_lk_resume (call_frame_t *frame, xlator_t *bound_xl) goto err; STACK_WIND (frame, server_lk_cbk, bound_xl, bound_xl->fops->lk, - state->fd, state->cmd, &state->flock); + state->fd, state->cmd, &state->flock, state->xdata); return 0; err: server_lk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -1757,11 +2025,11 @@ server_rename_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_rename_cbk, bound_xl, bound_xl->fops->rename, - &state->loc, &state->loc2); + &state->loc, &state->loc2, state->xdata); return 0; err: server_rename_cbk (frame, NULL, frame->this, op_ret, op_errno, - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -1790,12 +2058,12 @@ server_link_resume (call_frame_t *frame, xlator_t *bound_xl) state->loc2.inode = inode_ref (state->loc.inode); STACK_WIND (frame, server_link_cbk, bound_xl, bound_xl->fops->link, - &state->loc, &state->loc2); + &state->loc, &state->loc2, state->xdata); return 0; err: server_link_cbk (frame, NULL, frame->this, op_ret, op_errno, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); return 0; } @@ -1813,12 +2081,12 @@ server_symlink_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_symlink_cbk, bound_xl, bound_xl->fops->symlink, - state->name, &state->loc, state->params); + state->name, &state->loc, state->umask, state->xdata); return 0; err: server_symlink_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -1835,11 +2103,11 @@ server_access_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_access_cbk, bound_xl, bound_xl->fops->access, - &state->loc, state->mask); + &state->loc, state->mask, state->xdata); return 0; err: server_access_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1856,12 +2124,12 @@ server_fentrylk_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fentrylk_cbk, bound_xl, bound_xl->fops->fentrylk, state->volume, state->fd, state->name, - state->cmd, state->type); + state->cmd, state->type, state->xdata); return 0; err: server_fentrylk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1879,11 +2147,11 @@ server_entrylk_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_entrylk_cbk, bound_xl, bound_xl->fops->entrylk, state->volume, &state->loc, state->name, - state->cmd, state->type); + state->cmd, state->type, state->xdata); return 0; err: server_entrylk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1899,13 +2167,13 @@ server_finodelk_resume (call_frame_t *frame, xlator_t *bound_xl) goto err; STACK_WIND (frame, server_finodelk_cbk, bound_xl, - bound_xl->fops->finodelk, - state->volume, state->fd, state->cmd, &state->flock); + bound_xl->fops->finodelk, state->volume, state->fd, + state->cmd, &state->flock, state->xdata); return 0; err: server_finodelk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1920,13 +2188,13 @@ server_inodelk_resume (call_frame_t *frame, xlator_t *bound_xl) if (state->resolve.op_ret != 0) goto err; - STACK_WIND (frame, server_inodelk_cbk, - bound_xl, bound_xl->fops->inodelk, - state->volume, &state->loc, state->cmd, &state->flock); + STACK_WIND (frame, server_inodelk_cbk, bound_xl, + bound_xl->fops->inodelk, state->volume, &state->loc, + state->cmd, &state->flock, state->xdata); return 0; err: server_inodelk_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -1940,12 +2208,12 @@ server_rmdir_resume (call_frame_t *frame, xlator_t *bound_xl) if (state->resolve.op_ret != 0) goto err; - STACK_WIND (frame, server_rmdir_cbk, - bound_xl, bound_xl->fops->rmdir, &state->loc, state->flags); + STACK_WIND (frame, server_rmdir_cbk, bound_xl, bound_xl->fops->rmdir, + &state->loc, state->flags, state->xdata); return 0; err: server_rmdir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -1964,12 +2232,12 @@ server_mkdir_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_mkdir_cbk, bound_xl, bound_xl->fops->mkdir, - &(state->loc), state->mode, state->params); + &(state->loc), state->mode, state->umask, state->xdata); return 0; err: server_mkdir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -1989,12 +2257,12 @@ server_mknod_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_mknod_cbk, bound_xl, bound_xl->fops->mknod, &(state->loc), state->mode, state->dev, - state->params); + state->umask, state->xdata); return 0; err: server_mknod_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -2012,13 +2280,13 @@ server_fsyncdir_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fsyncdir_cbk, bound_xl, bound_xl->fops->fsyncdir, - state->fd, state->flags); + state->fd, state->flags, state->xdata); return 0; err: server_fsyncdir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2036,12 +2304,12 @@ server_readdir_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_readdir_cbk, bound_xl, bound_xl->fops->readdir, - state->fd, state->size, state->offset); + state->fd, state->size, state->offset, state->xdata); return 0; err: server_readdir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2062,7 +2330,7 @@ server_readdirp_resume (call_frame_t *frame, xlator_t *bound_xl) return 0; err: server_readdirp_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2081,11 +2349,11 @@ server_opendir_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_opendir_cbk, bound_xl, bound_xl->fops->opendir, - &state->loc, state->fd); + &state->loc, state->fd, state->xdata); return 0; err: server_opendir_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2102,12 +2370,12 @@ server_statfs_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_statfs_cbk, bound_xl, bound_xl->fops->statfs, - &state->loc); + &state->loc, state->xdata); return 0; err: server_statfs_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2124,11 +2392,11 @@ server_removexattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_removexattr_cbk, bound_xl, bound_xl->fops->removexattr, - &state->loc, state->name); + &state->loc, state->name, state->xdata); return 0; err: server_removexattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2144,11 +2412,11 @@ server_fremovexattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fremovexattr_cbk, bound_xl, bound_xl->fops->fremovexattr, - state->fd, state->name); + state->fd, state->name, state->xdata); return 0; err: server_fremovexattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2164,11 +2432,11 @@ server_fgetxattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fgetxattr_cbk, bound_xl, bound_xl->fops->fgetxattr, - state->fd, state->name); + state->fd, state->name, state->xdata); return 0; err: server_fgetxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2185,11 +2453,11 @@ server_xattrop_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_xattrop_cbk, bound_xl, bound_xl->fops->xattrop, - &state->loc, state->flags, state->dict); + &state->loc, state->flags, state->dict, state->xdata); return 0; err: server_xattrop_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2205,11 +2473,11 @@ server_fxattrop_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fxattrop_cbk, bound_xl, bound_xl->fops->fxattrop, - state->fd, state->flags, state->dict); + state->fd, state->flags, state->dict, state->xdata); return 0; err: server_fxattrop_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2225,11 +2493,11 @@ server_fsetxattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_setxattr_cbk, bound_xl, bound_xl->fops->fsetxattr, - state->fd, state->dict, state->flags); + state->fd, state->dict, state->flags, state->xdata); return 0; err: server_fsetxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2246,11 +2514,11 @@ server_unlink_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_unlink_cbk, bound_xl, bound_xl->fops->unlink, - &state->loc); + &state->loc, state->flags, state->xdata); return 0; err: server_unlink_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2266,11 +2534,11 @@ server_truncate_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_truncate_cbk, bound_xl, bound_xl->fops->truncate, - &state->loc, state->offset); + &state->loc, state->offset, state->xdata); return 0; err: server_truncate_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2288,11 +2556,11 @@ server_fstat_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fstat_cbk, bound_xl, bound_xl->fops->fstat, - state->fd); + state->fd, state->xdata); return 0; err: server_fstat_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2309,11 +2577,11 @@ server_setxattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_setxattr_cbk, bound_xl, bound_xl->fops->setxattr, - &state->loc, state->dict, state->flags); + &state->loc, state->dict, state->flags, state->xdata); return 0; err: server_setxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2331,11 +2599,11 @@ server_getxattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_getxattr_cbk, bound_xl, bound_xl->fops->getxattr, - &state->loc, state->name); + &state->loc, state->name, state->xdata); return 0; err: server_getxattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2352,11 +2620,11 @@ server_ftruncate_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_ftruncate_cbk, bound_xl, bound_xl->fops->ftruncate, - state->fd, state->offset); + state->fd, state->offset, state->xdata); return 0; err: server_ftruncate_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2373,11 +2641,11 @@ server_flush_resume (call_frame_t *frame, xlator_t *bound_xl) goto err; STACK_WIND (frame, server_flush_cbk, - bound_xl, bound_xl->fops->flush, state->fd); + bound_xl, bound_xl->fops->flush, state->fd, state->xdata); return 0; err: server_flush_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno); + state->resolve.op_errno, NULL); return 0; } @@ -2395,11 +2663,11 @@ server_fsync_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fsync_cbk, bound_xl, bound_xl->fops->fsync, - state->fd, state->flags); + state->fd, state->flags, state->xdata); return 0; err: server_fsync_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2417,12 +2685,12 @@ server_writev_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_writev_cbk, bound_xl, bound_xl->fops->writev, state->fd, state->payload_vector, state->payload_count, - state->offset, state->flags, state->iobref); + state->offset, state->flags, state->iobref, state->xdata); return 0; err: server_writev_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2439,12 +2707,12 @@ server_readv_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_readv_cbk, bound_xl, bound_xl->fops->readv, - state->fd, state->size, state->offset, state->flags); + state->fd, state->size, state->offset, state->flags, state->xdata); return 0; err: server_readv_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, 0, NULL, NULL); + state->resolve.op_errno, NULL, 0, NULL, NULL, NULL); return 0; } @@ -2475,13 +2743,13 @@ server_create_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_create_cbk, bound_xl, bound_xl->fops->create, &(state->loc), state->flags, state->mode, - state->fd, state->params); + state->umask, state->fd, state->xdata); return 0; err: server_create_cbk (frame, NULL, frame->this, state->resolve.op_ret, state->resolve.op_errno, NULL, NULL, NULL, - NULL, NULL); + NULL, NULL, NULL); return 0; } @@ -2501,12 +2769,12 @@ server_open_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_open_cbk, bound_xl, bound_xl->fops->open, - &state->loc, state->flags, state->fd, 0); + &state->loc, state->flags, state->fd, state->xdata); return 0; err: server_open_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2523,11 +2791,11 @@ server_readlink_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_readlink_cbk, bound_xl, bound_xl->fops->readlink, - &state->loc, state->size); + &state->loc, state->size, state->xdata); return 0; err: server_readlink_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2544,11 +2812,11 @@ server_fsetattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_fsetattr_cbk, bound_xl, bound_xl->fops->fsetattr, - state->fd, &state->stbuf, state->valid); + state->fd, &state->stbuf, state->valid, state->xdata); return 0; err: server_fsetattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2566,11 +2834,11 @@ server_setattr_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_setattr_cbk, bound_xl, bound_xl->fops->setattr, - &state->loc, &state->stbuf, state->valid); + &state->loc, &state->stbuf, state->valid, state->xdata); return 0; err: server_setattr_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, NULL); + state->resolve.op_errno, NULL, NULL, NULL); return 0; } @@ -2587,11 +2855,11 @@ server_stat_resume (call_frame_t *frame, xlator_t *bound_xl) goto err; STACK_WIND (frame, server_stat_cbk, - bound_xl, bound_xl->fops->stat, &state->loc); + bound_xl, bound_xl->fops->stat, &state->loc, state->xdata); return 0; err: server_stat_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL); + state->resolve.op_errno, NULL, NULL); return 0; } @@ -2612,7 +2880,7 @@ server_lookup_resume (call_frame_t *frame, xlator_t *bound_xl) STACK_WIND (frame, server_lookup_cbk, bound_xl, bound_xl->fops->lookup, - &state->loc, state->dict); + &state->loc, state->xdata); return 0; err: @@ -2630,10 +2898,11 @@ err: int server_stat (rpcsvc_request_t *req) { - server_state_t *state = NULL; - call_frame_t *frame = NULL; - gfs3_stat_req args = {{0,},}; - int ret = -1; + server_state_t *state = NULL; + call_frame_t *frame = NULL; + gfs3_stat_req args = {{0,},}; + int ret = -1; + int op_errno = 0; if (!req) return 0; @@ -2664,9 +2933,22 @@ server_stat (rpcsvc_request_t *req) state->resolve.type = RESOLVE_MUST; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + + ret = 0; resolve_and_resume (frame, server_stat_resume); + out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -2678,6 +2960,7 @@ server_setattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_setattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return 0; @@ -2709,9 +2992,21 @@ server_setattr (rpcsvc_request_t *req) gf_stat_to_iatt (&args.stbuf, &state->stbuf); state->valid = args.valid; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_setattr_resume); + out: + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + return ret; } @@ -2723,6 +3018,7 @@ server_fsetattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fsetattr_req args = {0,}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -2754,9 +3050,21 @@ server_fsetattr (rpcsvc_request_t *req) gf_stat_to_iatt (&args.stbuf, &state->stbuf); state->valid = args.valid; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fsetattr_resume); + out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -2768,6 +3076,7 @@ server_readlink (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_readlink_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -2798,9 +3107,21 @@ server_readlink (rpcsvc_request_t *req) state->size = args.size; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_readlink_resume); + out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -2810,7 +3131,6 @@ server_create (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - dict_t *params = NULL; gfs3_create_req args = {{0,},}; int ret = -1; int op_errno = 0; @@ -2841,16 +3161,10 @@ server_create (rpcsvc_request_t *req) goto out; } - /* Unserialize the dictionary */ - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, params, - (args.dict.dict_val), - (args.dict.dict_len), ret, - op_errno, out); - - state->params = params; state->resolve.bname = gf_strdup (args.bname); state->mode = args.mode; + state->umask = args.umask; state->flags = gf_flags_to_flags (args.flags); memcpy (state->resolve.pargfid, args.pargfid, 16); @@ -2860,27 +3174,23 @@ server_create (rpcsvc_request_t *req) state->resolve.type = RESOLVE_DONTCARE; } + /* TODO: can do alloca for xdata field instead of stdalloc */ + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_create_resume); +out: /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); - return ret; -out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (params) - dict_unref (params); - - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } - return ret; } @@ -2892,6 +3202,7 @@ server_open (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_open_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -2922,9 +3233,20 @@ server_open (rpcsvc_request_t *req) state->flags = gf_flags_to_flags (args.flags); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_open_resume); out: + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + return ret; } @@ -2936,6 +3258,7 @@ server_readv (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_read_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) goto out; @@ -2969,9 +3292,21 @@ server_readv (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_readv_resume); out: + /* memory allocated by libc, don't use GF_FREE */ + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -2985,6 +3320,7 @@ server_writev (rpcsvc_request_t *req) ssize_t len = 0; int i = 0; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3035,9 +3371,20 @@ server_writev (rpcsvc_request_t *req) state->size += state->payload_vector[i].iov_len; } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_writev_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3093,6 +3440,7 @@ server_release (rpcsvc_request_t *req) server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + ret = 0; out: return ret; @@ -3117,6 +3465,7 @@ server_releasedir (rpcsvc_request_t *req) server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_common_rsp); + ret = 0; out: return ret; @@ -3130,6 +3479,7 @@ server_fsync (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fsync_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3160,9 +3510,20 @@ server_fsync (rpcsvc_request_t *req) state->flags = args.data; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fsync_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3175,6 +3536,7 @@ server_flush (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_flush_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3204,9 +3566,20 @@ server_flush (rpcsvc_request_t *req) state->resolve.fd_no = args.fd; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_flush_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3219,6 +3592,7 @@ server_ftruncate (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_ftruncate_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3249,9 +3623,20 @@ server_ftruncate (rpcsvc_request_t *req) state->offset = args.offset; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_ftruncate_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3261,8 +3646,9 @@ server_fstat (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - gfs3_write_req args = {{0,},}; + gfs3_fstat_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3292,9 +3678,20 @@ server_fstat (rpcsvc_request_t *req) state->resolve.fd_no = args.fd; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fstat_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3306,6 +3703,7 @@ server_truncate (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_truncate_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3335,9 +3733,20 @@ server_truncate (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); state->offset = args.offset; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_truncate_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3350,6 +3759,7 @@ server_unlink (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_unlink_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3381,9 +3791,22 @@ server_unlink (rpcsvc_request_t *req) state->resolve.bname = gf_strdup (args.bname); memcpy (state->resolve.pargfid, args.pargfid, 16); + state->flags = args.xflags; + + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_unlink_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3397,7 +3820,7 @@ server_setxattr (rpcsvc_request_t *req) server_connection_t *conn = NULL; gfs3_setxattr_req args = {{0,},}; int32_t ret = -1; - int op_errno = 0; + int32_t op_errno = 0; if (!req) return ret; @@ -3441,17 +3864,25 @@ server_setxattr (rpcsvc_request_t *req) /* There can be some commands hidden in key, check and proceed */ gf_server_check_setxattr_cmd (frame, dict); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_setxattr_resume); return ret; out: - if (dict) - dict_unref (dict); + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; + if (dict) + dict_unref (dict); + return ret; } @@ -3466,7 +3897,7 @@ server_fsetxattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fsetxattr_req args = {{0,},}; int32_t ret = -1; - int op_errno = 0; + int32_t op_errno = 0; if (!req) return ret; @@ -3507,15 +3938,25 @@ server_fsetxattr (rpcsvc_request_t *req) state->dict = dict; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fsetxattr_resume); return ret; out: - if (dict) - dict_unref (dict); + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + if (op_errno) req->rpc_err = GARBAGE_ARGS; + + if (dict) + dict_unref (dict); + return ret; } @@ -3530,7 +3971,7 @@ server_fxattrop (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fxattrop_req args = {{0,},}; int32_t ret = -1; - int op_errno = 0; + int32_t op_errno = 0; if (!req) return ret; @@ -3571,17 +4012,26 @@ server_fxattrop (rpcsvc_request_t *req) state->dict = dict; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fxattrop_resume); return ret; out: - if (dict) - dict_unref (dict); + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + if (op_errno) req->rpc_err = GARBAGE_ARGS; + if (dict) + dict_unref (dict); + return ret; } @@ -3596,7 +4046,7 @@ server_xattrop (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_xattrop_req args = {{0,},}; int32_t ret = -1; - int op_errno = 0; + int32_t op_errno = 0; if (!req) return ret; @@ -3637,17 +4087,25 @@ server_xattrop (rpcsvc_request_t *req) state->dict = dict; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_xattrop_resume); return ret; out: - if (dict) - dict_unref (dict); + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); if (op_errno) req->rpc_err = GARBAGE_ARGS; + if (dict) + dict_unref (dict); + return ret; } @@ -3659,6 +4117,7 @@ server_getxattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_getxattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3695,9 +4154,20 @@ server_getxattr (rpcsvc_request_t *req) gf_server_check_getxattr_cmd (frame, state->name); } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_getxattr_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3709,6 +4179,7 @@ server_fgetxattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fgetxattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3742,9 +4213,20 @@ server_fgetxattr (rpcsvc_request_t *req) if (args.namelen) state->name = gf_strdup (args.name); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fgetxattr_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3757,6 +4239,7 @@ server_removexattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_removexattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3788,9 +4271,20 @@ server_removexattr (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); state->name = gf_strdup (args.name); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_removexattr_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3801,6 +4295,7 @@ server_fremovexattr (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fremovexattr_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3834,9 +4329,20 @@ server_fremovexattr (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); state->name = gf_strdup (args.name); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fremovexattr_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3850,6 +4356,7 @@ server_opendir (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_opendir_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -3878,9 +4385,20 @@ server_opendir (rpcsvc_request_t *req) state->resolve.type = RESOLVE_MUST; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_opendir_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -3893,7 +4411,7 @@ server_readdirp (rpcsvc_request_t *req) gfs3_readdirp_req args = {{0,},}; size_t headers_size = 0; int ret = -1; - int op_errno = 0; + int op_errno = 0; if (!req) return ret; @@ -3935,6 +4453,7 @@ server_readdirp (rpcsvc_request_t *req) state->offset = args.offset; memcpy (state->resolve.gfid, args.gfid, 16); + /* here, dict itself works as xdata */ GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->dict, (args.dict.dict_val), (args.dict.dict_len), ret, @@ -3947,9 +4466,8 @@ out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (args.dict.dict_val != NULL) { + if (args.dict.dict_val) free (args.dict.dict_val); - } return ret; } @@ -3962,6 +4480,7 @@ server_readdir (rpcsvc_request_t *req) gfs3_readdir_req args = {{0,},}; size_t headers_size = 0; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4003,9 +4522,20 @@ server_readdir (rpcsvc_request_t *req) state->offset = args.offset; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_readdir_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4016,6 +4546,7 @@ server_fsyncdir (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fsyncdir_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4046,9 +4577,20 @@ server_fsyncdir (rpcsvc_request_t *req) state->flags = args.data; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fsyncdir_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4059,10 +4601,9 @@ server_mknod (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - dict_t *params = NULL; gfs3_mknod_req args = {{0,},}; int ret = -1; - int op_errno = 0; + int op_errno = 0; if (!req) return ret; @@ -4090,40 +4631,29 @@ server_mknod (rpcsvc_request_t *req) goto out; } - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, params, - (args.dict.dict_val), - (args.dict.dict_len), ret, - op_errno, out); - - state->params = params; - state->resolve.type = RESOLVE_NOT; memcpy (state->resolve.pargfid, args.pargfid, 16); state->resolve.bname = gf_strdup (args.bname); - state->mode = args.mode; - state->dev = args.dev; + state->mode = args.mode; + state->dev = args.dev; + state->umask = args.umask; + + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); ret = 0; resolve_and_resume (frame, server_mknod_resume); - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } - - return ret; out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (params) - dict_unref (params); - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); return ret; @@ -4135,10 +4665,9 @@ server_mkdir (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - dict_t *params = NULL; gfs3_mkdir_req args = {{0,},}; int ret = -1; - int op_errno = 0; + int op_errno = 0; if (!req) return ret; @@ -4165,39 +4694,29 @@ server_mkdir (rpcsvc_request_t *req) req->rpc_err = GARBAGE_ARGS; goto out; } - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, params, - (args.dict.dict_val), - (args.dict.dict_len), ret, - op_errno, out); - - state->params = params; state->resolve.type = RESOLVE_NOT; memcpy (state->resolve.pargfid, args.pargfid, 16); state->resolve.bname = gf_strdup (args.bname); - state->mode = args.mode; + state->mode = args.mode; + state->umask = args.umask; + + /* TODO: can do alloca for xdata field instead of stdalloc */ + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); ret = 0; resolve_and_resume (frame, server_mkdir_resume); - if (args.dict.dict_val != NULL) { - /* memory allocated by libc, don't use GF_FREE */ - free (args.dict.dict_val); - } - - return ret; out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (params) - dict_unref (params); - - if (args.dict.dict_val != NULL) { - /* memory allocated by libc, don't use GF_FREE */ - free (args.dict.dict_val); - } + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); return ret; } @@ -4210,6 +4729,7 @@ server_rmdir (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_rmdir_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4241,11 +4761,22 @@ server_rmdir (rpcsvc_request_t *req) memcpy (state->resolve.pargfid, args.pargfid, 16); state->resolve.bname = gf_strdup (args.bname); - state->flags = args.flags; + state->flags = args.xflags; + + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); ret = 0; resolve_and_resume (frame, server_rmdir_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4259,6 +4790,7 @@ server_inodelk (rpcsvc_request_t *req) gfs3_inodelk_req args = {{0,},}; int cmd = 0; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4319,9 +4851,20 @@ server_inodelk (rpcsvc_request_t *req) break; } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_inodelk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4332,6 +4875,7 @@ server_finodelk (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_finodelk_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4392,9 +4936,20 @@ server_finodelk (rpcsvc_request_t *req) break; } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_finodelk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4406,6 +4961,7 @@ server_entrylk (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_entrylk_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4444,9 +5000,20 @@ server_entrylk (rpcsvc_request_t *req) state->cmd = args.cmd; state->type = args.type; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_entrylk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4457,6 +5024,7 @@ server_fentrylk (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_fentrylk_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4495,9 +5063,20 @@ server_fentrylk (rpcsvc_request_t *req) state->name = gf_strdup (args.name); state->volume = gf_strdup (args.volume); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_fentrylk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4508,6 +5087,7 @@ server_access (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_access_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4537,9 +5117,20 @@ server_access (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); state->mask = args.mask; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_access_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4550,10 +5141,9 @@ server_symlink (rpcsvc_request_t *req) { server_state_t *state = NULL; call_frame_t *frame = NULL; - dict_t *params = NULL; gfs3_symlink_req args = {{0,},}; int ret = -1; - int op_errno = 0; + int op_errno = 0; if (!req) return ret; @@ -4582,37 +5172,27 @@ server_symlink (rpcsvc_request_t *req) goto out; } - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, params, - (args.dict.dict_val), - (args.dict.dict_len), ret, - op_errno, out); - - state->params = params; - state->resolve.type = RESOLVE_NOT; memcpy (state->resolve.pargfid, args.pargfid, 16); state->resolve.bname = gf_strdup (args.bname); state->name = gf_strdup (args.linkname); + state->umask = args.umask; + + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); ret = 0; resolve_and_resume (frame, server_symlink_resume); - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } - return ret; out: if (op_errno) req->rpc_err = GARBAGE_ARGS; - if (params) - dict_unref (params); - /* memory allocated by libc, don't use GF_FREE */ - if (args.dict.dict_val != NULL) { - free (args.dict.dict_val); - } + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); return ret; } @@ -4626,6 +5206,7 @@ server_link (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_link_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4660,9 +5241,20 @@ server_link (rpcsvc_request_t *req) state->resolve2.bname = gf_strdup (args.newbname); memcpy (state->resolve2.pargfid, args.newgfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_link_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4674,6 +5266,7 @@ server_rename (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_rename_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4710,9 +5303,20 @@ server_rename (rpcsvc_request_t *req) state->resolve2.bname = gf_strdup (args.newbname); memcpy (state->resolve2.pargfid, args.newgfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_rename_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4724,6 +5328,7 @@ server_lk (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_lk_req args = {{0,},}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4803,9 +5408,20 @@ server_lk (rpcsvc_request_t *req) } + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_lk_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4817,6 +5433,7 @@ server_rchecksum (rpcsvc_request_t *req) call_frame_t *frame = NULL; gfs3_rchecksum_req args = {0,}; int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4847,9 +5464,20 @@ server_rchecksum (rpcsvc_request_t *req) state->offset = args.offset; state->size = args.len; + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_rchecksum_resume); out: + if (args.xdata.xdata_val) + free (args.xdata.xdata_val); + + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } @@ -4870,20 +5498,19 @@ server_null (rpcsvc_request_t *req) int server_lookup (rpcsvc_request_t *req) { - call_frame_t *frame = NULL; - server_connection_t *conn = NULL; - server_state_t *state = NULL; - dict_t *xattr_req = NULL; - gfs3_lookup_req args = {{0,},}; - int ret = -1; - int op_errno = 0; + call_frame_t *frame = NULL; + server_connection_t *conn = NULL; + server_state_t *state = NULL; + gfs3_lookup_req args = {{0,},}; + int ret = -1; + int op_errno = 0; GF_VALIDATE_OR_GOTO ("server", req, err); conn = req->trans->xl_private; - args.bname = alloca (req->msg[0].iov_len); - args.dict.dict_val = alloca (req->msg[0].iov_len); + args.bname = alloca (req->msg[0].iov_len); + args.xdata.xdata_val = alloca (req->msg[0].iov_len); if (!xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_lookup_req)) { //failed to decode msg; @@ -4919,19 +5546,16 @@ server_lookup (rpcsvc_request_t *req) memcpy (state->resolve.gfid, args.gfid, 16); } - GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, xattr_req, - (args.dict.dict_val), - (args.dict.dict_len), ret, + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, op_errno, out); - state->dict = xattr_req; ret = 0; resolve_and_resume (frame, server_lookup_resume); return ret; out: - if (xattr_req) - dict_unref (xattr_req); server_lookup_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL, NULL, NULL); @@ -4946,7 +5570,8 @@ server_statfs (rpcsvc_request_t *req) server_state_t *state = NULL; call_frame_t *frame = NULL; gfs3_statfs_req args = {{0,},}; - int ret = -1; + int ret = -1; + int op_errno = 0; if (!req) return ret; @@ -4975,9 +5600,17 @@ server_statfs (rpcsvc_request_t *req) state->resolve.type = RESOLVE_MUST; memcpy (state->resolve.gfid, args.gfid, 16); + GF_PROTOCOL_DICT_UNSERIALIZE (state->conn->bound_xl, state->xdata, + (args.xdata.xdata_val), + (args.xdata.xdata_len), ret, + op_errno, out); + ret = 0; resolve_and_resume (frame, server_statfs_resume); out: + if (op_errno) + req->rpc_err = GARBAGE_ARGS; + return ret; } |