diff options
Diffstat (limited to 'xlators/protocol/client/src/client-rpc-fops_v2.c')
| -rw-r--r-- | xlators/protocol/client/src/client-rpc-fops_v2.c | 1276 |
1 files changed, 592 insertions, 684 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops_v2.c b/xlators/protocol/client/src/client-rpc-fops_v2.c index 55a9fd04a6a..0d80d4e8efb 100644 --- a/xlators/protocol/client/src/client-rpc-fops_v2.c +++ b/xlators/protocol/client/src/client-rpc-fops_v2.c @@ -12,11 +12,10 @@ #include "rpc-common-xdr.h" #include "glusterfs4-xdr.h" #include "glusterfs3.h" -#include "compat-errno.h" +#include <glusterfs/compat-errno.h> #include "client-messages.h" -#include "defaults.h" +#include <glusterfs/defaults.h> #include "client-common.h" -#include "compound-fop-utils.h" extern int32_t client3_getspec(call_frame_t *frame, xlator_t *this, void *data); @@ -60,8 +59,8 @@ client4_0_symlink_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -76,10 +75,9 @@ out: /* no need to print the gfid, because it will be null, * since symlink operation failed. */ - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, - "remote operation failed. Path: (%s to %s)", local->loc.path, - local->loc2.path); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, "source=%s", local->loc.path, + "target=%s", local->loc2.path, NULL); } } @@ -131,8 +129,8 @@ client4_0_mknod_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -144,10 +142,10 @@ client4_0_mknod_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1 && GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) { - gf_msg(this->name, - fop_log_level(GF_FOP_MKNOD, gf_error_to_errno(rsp.op_errno)), - gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, - "remote operation failed. Path: %s", local->loc.path); + gf_smsg(this->name, + fop_log_level(GF_FOP_MKNOD, gf_error_to_errno(rsp.op_errno)), + gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, + "path=%s", local->loc.path, NULL); } CLIENT_STACK_UNWIND(mknod, frame, rsp.op_ret, @@ -197,8 +195,8 @@ client4_0_mkdir_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -210,10 +208,10 @@ client4_0_mkdir_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1 && GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) { - gf_msg(this->name, - fop_log_level(GF_FOP_MKDIR, gf_error_to_errno(rsp.op_errno)), - gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, - "remote operation failed. Path: %s", local->loc.path); + gf_smsg(this->name, + fop_log_level(GF_FOP_MKDIR, gf_error_to_errno(rsp.op_errno)), + gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, + "path=%s", local->loc.path, NULL); } CLIENT_STACK_UNWIND(mkdir, frame, rsp.op_ret, @@ -254,8 +252,8 @@ client4_0_open_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -274,11 +272,11 @@ client4_0_open_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, - fop_log_level(GF_FOP_OPEN, gf_error_to_errno(rsp.op_errno)), - gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, - "remote operation failed. Path: %s (%s)", local->loc.path, - loc_gfid_utoa(&local->loc)); + gf_smsg(this->name, + fop_log_level(GF_FOP_OPEN, gf_error_to_errno(rsp.op_errno)), + gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, + "path=%s", local->loc.path, "gfid=%s", + loc_gfid_utoa(&local->loc), NULL); } CLIENT_STACK_UNWIND(open, frame, rsp.op_ret, @@ -316,8 +314,8 @@ client4_0_stat_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -332,8 +330,8 @@ out: gf_msg_debug(this->name, 0, "remote operation failed: %s", strerror(gf_error_to_errno(rsp.op_errno))); } else { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } } @@ -372,8 +370,8 @@ client4_0_readlink_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_readlink_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -389,10 +387,8 @@ out: " %s", strerror(gf_error_to_errno(rsp.op_errno))); } else { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, - "remote operation " - "failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } } @@ -439,8 +435,8 @@ client4_0_unlink_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -456,10 +452,8 @@ out: " %s", strerror(gf_error_to_errno(rsp.op_errno))); } else { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, - "remote operation " - "failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } } @@ -502,8 +496,8 @@ client4_0_rmdir_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -514,8 +508,8 @@ client4_0_rmdir_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } } CLIENT_STACK_UNWIND(rmdir, frame, rsp.op_ret, @@ -557,8 +551,8 @@ client4_0_truncate_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -568,8 +562,8 @@ client4_0_truncate_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(truncate, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &prestat, &poststat, @@ -607,8 +601,8 @@ client4_0_statfs_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_statfs_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -620,8 +614,8 @@ client4_0_statfs_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(statfs, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &statfs, xdata); @@ -664,8 +658,8 @@ client4_0_writev_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -676,8 +670,8 @@ client4_0_writev_cbk(struct rpc_req *req, struct iovec *iov, int count, goto out; out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } else if (rsp.op_ret >= 0) { if (local->attempt_reopen) client_attempt_reopen(local->fd, this); @@ -716,14 +710,15 @@ client4_0_flush_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; } - if (rsp.op_ret >= 0 && !fd_is_anonymous(local->fd)) { + if ((rsp.op_ret >= 0 || (rsp.op_errno == ENOTCONN)) && + !fd_is_anonymous(local->fd)) { /* Delete all saved locks of the owner issuing flush */ ret = delete_granted_locks_owner(local->fd, &local->owner); gf_msg_trace(this->name, 0, "deleting locks of owner (%s) returned %d", @@ -734,10 +729,9 @@ client4_0_flush_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, - fop_log_level(GF_FOP_FLUSH, gf_error_to_errno(rsp.op_errno)), - gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, - "remote operation failed"); + gf_smsg(this->name, + fop_log_level(GF_FOP_FLUSH, gf_error_to_errno(rsp.op_errno)), + gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(flush, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), xdata); @@ -778,8 +772,8 @@ client4_0_fsync_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -791,8 +785,8 @@ client4_0_fsync_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(fsync, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &prestat, &poststat, @@ -828,8 +822,8 @@ client4_0_setxattr_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -845,10 +839,8 @@ out: " %s", strerror(op_errno)); } else { - gf_msg(this->name, GF_LOG_WARNING, op_errno, - PC_MSG_REMOTE_OP_FAILED, - "remote operation " - "failed"); + gf_smsg(this->name, GF_LOG_WARNING, op_errno, + PC_MSG_REMOTE_OP_FAILED, NULL); } } @@ -888,8 +880,8 @@ client4_0_getxattr_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; op_errno = EINVAL; goto out; @@ -913,12 +905,10 @@ out: loc_gfid_utoa(&local->loc), (local->name) ? local->name : "(null)"); } else { - gf_msg(this->name, GF_LOG_WARNING, op_errno, - PC_MSG_REMOTE_OP_FAILED, - "remote operation " - "failed. Path: %s (%s). Key: %s", - local->loc.path, loc_gfid_utoa(&local->loc), - (local->name) ? local->name : "(null)"); + gf_smsg(this->name, GF_LOG_WARNING, op_errno, + PC_MSG_REMOTE_OP_FAILED, "path=%s", local->loc.path, + "gfid=%s", loc_gfid_utoa(&local->loc), "key=%s", + (local->name) ? local->name : "(null)", NULL); } } else { /* This is required as many places, `if (ret)` is checked @@ -964,8 +954,8 @@ client4_0_fgetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; op_errno = EINVAL; goto out; @@ -984,10 +974,8 @@ out: gf_msg_debug(this->name, 0, "remote operation failed: %s", strerror(op_errno)); } else { - gf_msg(this->name, GF_LOG_WARNING, op_errno, - PC_MSG_REMOTE_OP_FAILED, - "remote operation " - "failed"); + gf_smsg(this->name, GF_LOG_WARNING, op_errno, + PC_MSG_REMOTE_OP_FAILED, NULL); } } else { /* This is required as many places, `if (ret)` is checked @@ -1033,8 +1021,8 @@ client4_0_removexattr_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1053,8 +1041,8 @@ out: else loglevel = GF_LOG_WARNING; - gf_msg(this->name, loglevel, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, loglevel, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(removexattr, frame, rsp.op_ret, @@ -1090,8 +1078,8 @@ client4_0_fremovexattr_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1100,8 +1088,8 @@ client4_0_fremovexattr_cbk(struct rpc_req *req, struct iovec *iov, int count, xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(fremovexattr, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), xdata); @@ -1135,8 +1123,8 @@ client4_0_fsyncdir_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1146,8 +1134,8 @@ client4_0_fsyncdir_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(fsyncdir, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), xdata); @@ -1181,8 +1169,8 @@ client4_0_access_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1192,8 +1180,8 @@ client4_0_access_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(access, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), xdata); @@ -1233,8 +1221,8 @@ client4_0_ftruncate_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1244,8 +1232,8 @@ client4_0_ftruncate_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(ftruncate, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &prestat, &poststat, @@ -1283,8 +1271,8 @@ client4_0_fstat_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1294,8 +1282,8 @@ client4_0_fstat_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(fstat, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &stat, xdata); @@ -1329,8 +1317,8 @@ client4_0_inodelk_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1339,10 +1327,9 @@ client4_0_inodelk_cbk(struct rpc_req *req, struct iovec *iov, int count, xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, - fop_log_level(GF_FOP_INODELK, gf_error_to_errno(rsp.op_errno)), - gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, - "remote operation failed"); + gf_smsg(this->name, + fop_log_level(GF_FOP_INODELK, gf_error_to_errno(rsp.op_errno)), + gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(inodelk, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), xdata); @@ -1377,8 +1364,8 @@ client4_0_finodelk_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1387,10 +1374,9 @@ client4_0_finodelk_cbk(struct rpc_req *req, struct iovec *iov, int count, xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, - fop_log_level(GF_FOP_FINODELK, gf_error_to_errno(rsp.op_errno)), - gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, - "remote operation failed"); + gf_smsg(this->name, + fop_log_level(GF_FOP_FINODELK, gf_error_to_errno(rsp.op_errno)), + gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL); } else if (rsp.op_ret == 0) { if (local->attempt_reopen) client_attempt_reopen(local->fd, this); @@ -1427,8 +1413,8 @@ client4_0_entrylk_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1437,10 +1423,9 @@ client4_0_entrylk_cbk(struct rpc_req *req, struct iovec *iov, int count, xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, - fop_log_level(GF_FOP_ENTRYLK, gf_error_to_errno(rsp.op_errno)), - gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, - "remote operation failed"); + gf_smsg(this->name, + fop_log_level(GF_FOP_ENTRYLK, gf_error_to_errno(rsp.op_errno)), + gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(entrylk, frame, rsp.op_ret, @@ -1475,8 +1460,8 @@ client4_0_fentrylk_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1486,8 +1471,8 @@ client4_0_fentrylk_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(fentrylk, frame, rsp.op_ret, @@ -1526,8 +1511,8 @@ client4_0_xattrop_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_dict_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; op_errno = EINVAL; goto out; @@ -1541,11 +1526,10 @@ client4_0_xattrop_cbk(struct rpc_req *req, struct iovec *iov, int count, } out: if (rsp.op_ret == -1) { - gf_msg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno), - gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, - "remote operation failed. " - "Path: %s (%s)", - local->loc.path, loc_gfid_utoa(&local->loc)); + gf_smsg(this->name, fop_log_level(GF_FOP_XATTROP, op_errno), + gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, + "Path=%s", local->loc.path, "gfid=%s", + loc_gfid_utoa(&local->loc), NULL); } else { /* This is required as many places, `if (ret)` is checked for syncop_xattrop() */ @@ -1596,8 +1580,8 @@ client4_0_fxattrop_cbk(struct rpc_req *req, struct iovec *iov, int count, if (ret < 0) { rsp.op_ret = -1; op_errno = EINVAL; - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); goto out; } op_errno = rsp.op_errno; @@ -1610,8 +1594,8 @@ client4_0_fxattrop_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } else { /* This is required as many places, `if (ret)` is checked for syncop_fxattrop() */ @@ -1658,8 +1642,8 @@ client4_0_fsetxattr_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1676,10 +1660,8 @@ out: " %s", strerror(op_errno)); } else { - gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno, - PC_MSG_REMOTE_OP_FAILED, - "remote operation " - "failed"); + gf_smsg(this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, NULL); } } @@ -1720,8 +1702,8 @@ client4_0_fallocate_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1733,8 +1715,8 @@ client4_0_fallocate_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(fallocate, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &prestat, &poststat, @@ -1775,8 +1757,8 @@ client4_0_discard_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1786,8 +1768,8 @@ client4_0_discard_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(discard, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &prestat, &poststat, @@ -1827,8 +1809,8 @@ client4_0_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1837,8 +1819,8 @@ client4_0_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = client_post_common_2iatt(this, &rsp, &prestat, &poststat, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(zerofill, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &prestat, &poststat, @@ -1873,8 +1855,8 @@ client4_0_ipc_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1883,8 +1865,8 @@ client4_0_ipc_cbk(struct rpc_req *req, struct iovec *iov, int count, xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(ipc, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), xdata); @@ -1918,8 +1900,8 @@ client4_0_seek_cbk(struct rpc_req *req, struct iovec *iov, int count, } ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_seek_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1928,8 +1910,8 @@ client4_0_seek_cbk(struct rpc_req *req, struct iovec *iov, int count, xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(seek, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), rsp.offset, xdata); @@ -1970,8 +1952,8 @@ client4_0_setattr_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -1981,8 +1963,8 @@ client4_0_setattr_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(setattr, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &prestat, &poststat, @@ -2024,8 +2006,8 @@ client4_0_fsetattr_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2035,8 +2017,8 @@ client4_0_fsetattr_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(fsetattr, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &prestat, &poststat, @@ -2087,18 +2069,19 @@ client4_0_create_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_create_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; } + ret = client_post_create_v2(this, &rsp, &stbuf, &preparent, &postparent, + local, &xdata); + if (ret < 0) + goto out; + if (-1 != rsp.op_ret) { - ret = client_post_create_v2(this, &rsp, &stbuf, &preparent, &postparent, - local, &xdata); - if (ret < 0) - goto out; ret = client_add_fd_to_saved_fds(frame->this, fd, &local->loc, local->flags, rsp.fd, 0); if (ret) { @@ -2110,9 +2093,8 @@ client4_0_create_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed. Path: %s", - local->loc.path); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, "path=%s", local->loc.path, NULL); } CLIENT_STACK_UNWIND(create, frame, rsp.op_ret, @@ -2145,8 +2127,8 @@ client4_0_lease_cbk(struct rpc_req *req, struct iovec *iov, int count, frame = myframe; if (-1 == req->rpc_status) { - gf_msg(this->name, GF_LOG_ERROR, ENOTCONN, PC_MSG_REMOTE_OP_FAILED, - "Lease fop failed"); + gf_smsg(this->name, GF_LOG_ERROR, ENOTCONN, PC_MSG_REMOTE_OP_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = ENOTCONN; goto out; @@ -2154,8 +2136,8 @@ client4_0_lease_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_lease_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2165,8 +2147,8 @@ client4_0_lease_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(lease, frame, rsp.op_ret, @@ -2192,10 +2174,12 @@ client4_0_lk_cbk(struct rpc_req *req, struct iovec *iov, int count, int ret = 0; xlator_t *this = NULL; dict_t *xdata = NULL; + clnt_local_t *local = NULL; this = THIS; frame = myframe; + local = frame->local; if (-1 == req->rpc_status) { rsp.op_ret = -1; @@ -2205,8 +2189,8 @@ client4_0_lk_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_lk_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2216,12 +2200,24 @@ client4_0_lk_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = client_post_lk_v2(this, &rsp, &lock, &xdata); if (ret < 0) goto out; + + /* Save the lock to the client lock cache to be able + to recover in the case of server reboot.*/ + + if (client_is_setlk(local->cmd)) { + ret = client_add_lock_for_recovery(local->fd, &lock, &local->owner, + local->cmd); + if (ret < 0) { + rsp.op_ret = -1; + rsp.op_errno = -ret; + } + } } out: if ((rsp.op_ret == -1) && (EAGAIN != gf_error_to_errno(rsp.op_errno))) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(lk, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), @@ -2264,8 +2260,8 @@ client4_0_readdir_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_readdir_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2275,9 +2271,8 @@ client4_0_readdir_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, - "remote operation failed: remote_fd = %d", local->cmd); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, "remote_fd=%d", local->cmd, NULL); } CLIENT_STACK_UNWIND(readdir, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &entries, xdata); @@ -2323,8 +2318,8 @@ client4_0_readdirp_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_readdirp_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2333,8 +2328,8 @@ client4_0_readdirp_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = client_post_readdirp_v2(this, &rsp, local->fd, &entries, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(readdirp, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &entries, xdata); @@ -2390,8 +2385,8 @@ client4_0_rename_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_rename_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2401,8 +2396,8 @@ client4_0_rename_cbk(struct rpc_req *req, struct iovec *iov, int count, &prenewparent, &postnewparent, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(rename, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), &stbuf, &preoldparent, @@ -2452,8 +2447,8 @@ client4_0_link_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2464,10 +2459,9 @@ client4_0_link_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, - "remote operation failed: (%s -> %s)", local->loc.path, - local->loc2.path); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, "source=%s", local->loc.path, + "target=%s", local->loc2.path, NULL); } } @@ -2512,8 +2506,8 @@ client4_0_opendir_cbk(struct rpc_req *req, struct iovec *iov, int count, but separated by fop number only */ ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_open_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2532,12 +2526,11 @@ client4_0_opendir_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, - fop_log_level(GF_FOP_OPENDIR, gf_error_to_errno(rsp.op_errno)), - gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, - "remote operation failed." - " Path: %s (%s)", - local->loc.path, loc_gfid_utoa(&local->loc)); + gf_smsg(this->name, + fop_log_level(GF_FOP_OPENDIR, gf_error_to_errno(rsp.op_errno)), + gf_error_to_errno(rsp.op_errno), PC_MSG_REMOTE_OP_FAILED, + "path=%s", local->loc.path, "gfid=%s", + loc_gfid_utoa(&local->loc), NULL); } CLIENT_STACK_UNWIND(opendir, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), fd, xdata); @@ -2583,8 +2576,8 @@ client4_0_lookup_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_2iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; op_errno = EINVAL; goto out; @@ -2613,7 +2606,7 @@ client4_0_lookup_cbk(struct rpc_req *req, struct iovec *iov, int count, rsp.op_ret = -1; op_errno = ESTALE; if (xdata) - ret = dict_set_int32(xdata, "gfid-changed", 1); + ret = dict_set_int32_sizen(xdata, "gfid-changed", 1); goto out; } @@ -2627,11 +2620,9 @@ out: /* any error other than ENOENT */ if (!(local->loc.name && rsp.op_errno == ENOENT) && !(rsp.op_errno == ESTALE)) - gf_msg(this->name, GF_LOG_WARNING, rsp.op_errno, - PC_MSG_REMOTE_OP_FAILED, - "remote operation " - "failed. Path: %s (%s)", - local->loc.path, loc_gfid_utoa(&local->loc)); + gf_smsg(this->name, GF_LOG_WARNING, rsp.op_errno, + PC_MSG_REMOTE_OP_FAILED, "path=%s", local->loc.path, + "gfid=%s", loc_gfid_utoa(&local->loc), NULL); else gf_msg_trace(this->name, 0, "not found on remote " @@ -2669,8 +2660,6 @@ client4_0_readv_cbk(struct rpc_req *req, struct iovec *iov, int count, this = THIS; - memset(vector, 0, sizeof(vector)); - frame = myframe; local = frame->local; @@ -2682,19 +2671,21 @@ client4_0_readv_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_read_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; } + memset(vector, 0, sizeof(vector)); + ret = client_post_readv_v2(this, &rsp, &iobref, req->rsp_iobref, &stat, vector, &req->rsp[1], &rspcount, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } else if (rsp.op_ret >= 0) { if (local->attempt_reopen) client_attempt_reopen(local->fd, this); @@ -2755,8 +2746,8 @@ client4_0_getactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_getactivelk_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2772,8 +2763,8 @@ client4_0_getactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(getactivelk, frame, rsp.op_ret, @@ -2810,8 +2801,8 @@ client4_0_setactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -2820,8 +2811,8 @@ client4_0_setactivelk_cbk(struct rpc_req *req, struct iovec *iov, int count, xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(setactivelk, frame, rsp.op_ret, @@ -2833,6 +2824,72 @@ out: return 0; } +int +client4_0_copy_file_range_cbk(struct rpc_req *req, struct iovec *iov, int count, + void *myframe) +{ + gfx_common_3iatt_rsp rsp = { + 0, + }; + call_frame_t *frame = NULL; + struct iatt stbuf = { + 0, + }; + struct iatt prestat = { + 0, + }; + struct iatt poststat = { + 0, + }; + int ret = 0; + xlator_t *this = NULL; + dict_t *xdata = NULL; + clnt_local_t *local = NULL; + + this = THIS; + + frame = myframe; + local = frame->local; + + if (-1 == req->rpc_status) { + rsp.op_ret = -1; + rsp.op_errno = ENOTCONN; + goto out; + } + + ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp); + if (ret < 0) { + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); + rsp.op_ret = -1; + rsp.op_errno = EINVAL; + goto out; + } + + ret = client_post_common_3iatt(this, &rsp, &stbuf, &prestat, &poststat, + &xdata); + if (ret < 0) + goto out; +out: + if (rsp.op_ret == -1) { + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); + } else if (rsp.op_ret >= 0) { + if (local->attempt_reopen) + client_attempt_reopen(local->fd, this); + if (local->attempt_reopen_out) + client_attempt_reopen(local->fd_out, this); + } + CLIENT_STACK_UNWIND(copy_file_range, frame, rsp.op_ret, + gf_error_to_errno(rsp.op_errno), &stbuf, &prestat, + &poststat, xdata); + + if (xdata) + dict_unref(xdata); + + return 0; +} + int32_t client4_0_releasedir(call_frame_t *frame, xlator_t *this, void *data) { @@ -2939,12 +2996,11 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data) struct iobref *rsp_iobref = NULL; struct iobuf *rsp_iobuf = NULL; struct iovec *rsphdr = NULL; + client_payload_t cp; if (!frame || !this || !data) goto unwind; - memset(vector, 0, sizeof(vector)); - conf = this->private; args = data; local = mem_get0(this->local_pool); @@ -2961,7 +3017,7 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data) loc_path(&local->loc, NULL); if (args->xdata) { - content = dict_get(args->xdata, GF_CONTENT_KEY); + content = dict_get_sizen(args->xdata, GF_CONTENT_KEY); if (content != NULL) { rsp_iobref = iobref_new(); if (rsp_iobref == NULL) { @@ -2977,6 +3033,7 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data) } iobref_add(rsp_iobref, rsp_iobuf); + memset(vector, 0, sizeof(vector)); rsphdr = &vector[0]; rsphdr->iov_base = iobuf_ptr(rsp_iobuf); rsphdr->iov_len = iobuf_pagesize(rsp_iobuf); @@ -2993,14 +3050,18 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data) op_errno = -ret; goto unwind; } + + memset(&cp, 0, sizeof(client_payload_t)); + + cp.rsphdr = rsphdr; + cp.rsphdr_cnt = count; + cp.rsp_iobref = local->iobref; ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LOOKUP, - client4_0_lookup_cbk, NULL, rsphdr, count, NULL, - 0, local->iobref, + client4_0_lookup_cbk, &cp, (xdrproc_t)xdr_gfx_lookup_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3043,11 +3104,10 @@ client4_0_stat(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STAT, - client4_0_stat_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_stat_req); + client4_0_stat_cbk, NULL, + (xdrproc_t)xdr_gfx_stat_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3087,11 +3147,10 @@ client4_0_truncate(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_TRUNCATE, - client4_0_truncate_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_truncate_req); + client4_0_truncate_cbk, NULL, + (xdrproc_t)xdr_gfx_truncate_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3132,11 +3191,9 @@ client4_0_ftruncate(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FTRUNCATE, client4_0_ftruncate_cbk, - NULL, NULL, 0, NULL, 0, NULL, - (xdrproc_t)xdr_gfx_ftruncate_req); + NULL, (xdrproc_t)xdr_gfx_ftruncate_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3175,11 +3232,10 @@ client4_0_access(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ACCESS, - client4_0_access_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_access_req); + client4_0_access_cbk, NULL, + (xdrproc_t)xdr_gfx_access_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3229,11 +3285,10 @@ client4_0_readlink(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READLINK, - client4_0_readlink_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_readlink_req); + client4_0_readlink_cbk, NULL, + (xdrproc_t)xdr_gfx_readlink_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3272,11 +3327,10 @@ client4_0_unlink(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_UNLINK, - client4_0_unlink_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_unlink_req); + client4_0_unlink_cbk, NULL, + (xdrproc_t)xdr_gfx_unlink_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3315,11 +3369,10 @@ client4_0_rmdir(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RMDIR, - client4_0_rmdir_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_rmdir_req); + client4_0_rmdir_cbk, NULL, + (xdrproc_t)xdr_gfx_rmdir_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3374,11 +3427,10 @@ client4_0_symlink(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SYMLINK, - client4_0_symlink_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_symlink_req); + client4_0_symlink_cbk, NULL, + (xdrproc_t)xdr_gfx_symlink_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3420,11 +3472,10 @@ client4_0_rename(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_RENAME, - client4_0_rename_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_rename_req); + client4_0_rename_cbk, NULL, + (xdrproc_t)xdr_gfx_rename_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3480,11 +3531,10 @@ client4_0_link(call_frame_t *frame, xlator_t *this, void *data) loc_path(&local->loc2, NULL); ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LINK, - client4_0_link_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_link_req); + client4_0_link_cbk, NULL, + (xdrproc_t)xdr_gfx_link_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3535,11 +3585,10 @@ client4_0_mknod(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKNOD, - client4_0_mknod_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_mknod_req); + client4_0_mknod_cbk, NULL, + (xdrproc_t)xdr_gfx_mknod_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3573,7 +3622,7 @@ client4_0_mkdir(call_frame_t *frame, xlator_t *this, void *data) args = data; conf = this->private; - if (!args->xdata || !dict_get(args->xdata, "gfid-req")) { + if (!args->xdata || !dict_get_sizen(args->xdata, "gfid-req")) { op_errno = EPERM; gf_msg_callingfn(this->name, GF_LOG_WARNING, op_errno, PC_MSG_GFID_NULL, "mkdir: %s is received " @@ -3602,11 +3651,10 @@ client4_0_mkdir(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_MKDIR, - client4_0_mkdir_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_mkdir_req); + client4_0_mkdir_cbk, NULL, + (xdrproc_t)xdr_gfx_mkdir_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3660,11 +3708,10 @@ client4_0_create(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_CREATE, - client4_0_create_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_create_req); + client4_0_create_cbk, NULL, + (xdrproc_t)xdr_gfx_create_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3721,11 +3768,10 @@ client4_0_open(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPEN, - client4_0_open_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_open_req); + client4_0_open_cbk, NULL, + (xdrproc_t)xdr_gfx_open_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3757,6 +3803,7 @@ client4_0_readv(call_frame_t *frame, xlator_t *this, void *data) }; struct iobuf *rsp_iobuf = NULL; struct iobref *rsp_iobref = NULL; + client_payload_t cp; if (!frame || !this || !data) goto unwind; @@ -3799,19 +3846,23 @@ client4_0_readv(call_frame_t *frame, xlator_t *this, void *data) rsp_iobuf = NULL; if (args->size > rsp_vec.iov_len) { - gf_msg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY, - "read-size (%lu) is bigger than iobuf size (%lu)", - (unsigned long)args->size, (unsigned long)rsp_vec.iov_len); + gf_smsg(this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_BIGGER_SIZE, + "read-size=%lu", (unsigned long)args->size, "iobuf-size=%lu", + (unsigned long)rsp_vec.iov_len, NULL); op_errno = EINVAL; goto unwind; } + memset(&cp, 0, sizeof(client_payload_t)); + + cp.rsp_payload = &rsp_vec; + cp.rsp_payload_cnt = 1; + cp.rsp_iobref = local->iobref; ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READ, - client4_0_readv_cbk, NULL, NULL, 0, &rsp_vec, 1, - local->iobref, (xdrproc_t)xdr_gfx_read_req); + client4_0_readv_cbk, &cp, + (xdrproc_t)xdr_gfx_read_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3839,6 +3890,7 @@ client4_0_writev(call_frame_t *frame, xlator_t *this, void *data) }; int op_errno = ESTALE; int ret = 0; + client_payload_t cp; if (!frame || !this || !data) goto unwind; @@ -3860,9 +3912,13 @@ client4_0_writev(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } + memset(&cp, 0, sizeof(client_payload_t)); + + cp.iobref = args->iobref; + cp.payload = args->vector; + cp.payload_cnt = args->count; ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_WRITE, - client4_0_writev_cbk, args->iobref, - args->vector, args->count, NULL, 0, NULL, + client4_0_writev_cbk, &cp, (xdrproc_t)xdr_gfx_write_req); if (ret) { /* @@ -3870,8 +3926,7 @@ client4_0_writev(call_frame_t *frame, xlator_t *this, void *data) * do the unwind for us (see rpc_clnt_submit), so don't unwind * here in such cases. */ - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3918,14 +3973,20 @@ client4_0_flush(call_frame_t *frame, xlator_t *this, void *data) ret = client_pre_flush_v2(this, &req, args->fd, args->xdata); if (ret) { op_errno = -ret; + if (op_errno == EBADF) { + ret = delete_granted_locks_owner(local->fd, &local->owner); + gf_msg_trace(this->name, 0, + "deleting locks of owner (%s) returned %d", + lkowner_utoa(&local->owner), ret); + } + goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FLUSH, - client4_0_flush_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_flush_req); + client4_0_flush_cbk, NULL, + (xdrproc_t)xdr_gfx_flush_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -3964,11 +4025,10 @@ client4_0_fsync(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNC, - client4_0_fsync_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_fsync_req); + client4_0_fsync_cbk, NULL, + (xdrproc_t)xdr_gfx_fsync_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4009,11 +4069,10 @@ client4_0_fstat(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSTAT, - client4_0_fstat_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_fstat_req); + client4_0_fstat_cbk, NULL, + (xdrproc_t)xdr_gfx_fstat_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4064,11 +4123,10 @@ client4_0_opendir(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_OPENDIR, - client4_0_opendir_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_opendir_req); + client4_0_opendir_cbk, NULL, + (xdrproc_t)xdr_gfx_opendir_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4109,11 +4167,10 @@ client4_0_fsyncdir(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSYNCDIR, - client4_0_fsyncdir_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_fsyncdir_req); + client4_0_fsyncdir_cbk, NULL, + (xdrproc_t)xdr_gfx_fsyncdir_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4153,11 +4210,10 @@ client4_0_statfs(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_STATFS, - client4_0_statfs_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_statfs_req); + client4_0_statfs_cbk, NULL, + (xdrproc_t)xdr_gfx_statfs_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4197,11 +4253,10 @@ client4_0_setxattr(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETXATTR, - client4_0_setxattr_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_setxattr_req); + client4_0_setxattr_cbk, NULL, + (xdrproc_t)xdr_gfx_setxattr_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.dict.pairs.pairs_val); @@ -4244,11 +4299,9 @@ client4_0_fsetxattr(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSETXATTR, client4_0_fsetxattr_cbk, - NULL, NULL, 0, NULL, 0, NULL, - (xdrproc_t)xdr_gfx_fsetxattr_req); + NULL, (xdrproc_t)xdr_gfx_fsetxattr_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.dict.pairs.pairs_val); @@ -4298,11 +4351,9 @@ client4_0_fgetxattr(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FGETXATTR, client4_0_fgetxattr_cbk, - NULL, NULL, 0, NULL, 0, NULL, - (xdrproc_t)xdr_gfx_fgetxattr_req); + NULL, (xdrproc_t)xdr_gfx_fgetxattr_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4365,9 +4416,8 @@ client4_0_getxattr(call_frame_t *frame, xlator_t *this, void *data) ret = client_dump_locks((char *)args->name, args->loc->inode, dict); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY, - "Client dump " - "locks failed"); + gf_smsg(this->name, GF_LOG_WARNING, EINVAL, + PC_MSG_CLIENT_DUMP_LOCKS_FAILED, NULL); op_errno = ENOMEM; goto unwind; } @@ -4386,11 +4436,10 @@ client4_0_getxattr(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_GETXATTR, - client4_0_getxattr_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_getxattr_req); + client4_0_getxattr_cbk, NULL, + (xdrproc_t)xdr_gfx_getxattr_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4448,11 +4497,10 @@ client4_0_xattrop(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_XATTROP, - client4_0_xattrop_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_xattrop_req); + client4_0_xattrop_cbk, NULL, + (xdrproc_t)xdr_gfx_xattrop_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.dict.pairs.pairs_val); @@ -4500,11 +4548,10 @@ client4_0_fxattrop(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FXATTROP, - client4_0_fxattrop_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_fxattrop_req); + client4_0_fxattrop_cbk, NULL, + (xdrproc_t)xdr_gfx_fxattrop_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.dict.pairs.pairs_val); @@ -4547,11 +4594,9 @@ client4_0_removexattr(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_REMOVEXATTR, client4_0_removexattr_cbk, - NULL, NULL, 0, NULL, 0, NULL, - (xdrproc_t)xdr_gfx_removexattr_req); + NULL, (xdrproc_t)xdr_gfx_removexattr_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4590,13 +4635,11 @@ client4_0_fremovexattr(call_frame_t *frame, xlator_t *this, void *data) op_errno = -ret; goto unwind; } - ret = client_submit_request(this, &req, frame, conf->fops, - GFS3_OP_FREMOVEXATTR, - client4_0_fremovexattr_cbk, NULL, NULL, 0, NULL, - 0, NULL, (xdrproc_t)xdr_gfx_fremovexattr_req); + ret = client_submit_request( + this, &req, frame, conf->fops, GFS3_OP_FREMOVEXATTR, + client4_0_fremovexattr_cbk, NULL, (xdrproc_t)xdr_gfx_fremovexattr_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4635,11 +4678,10 @@ client4_0_lease(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LEASE, - client4_0_lease_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_lease_req); + client4_0_lease_cbk, NULL, + (xdrproc_t)xdr_gfx_lease_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4682,8 +4724,8 @@ client4_0_lk(call_frame_t *frame, xlator_t *this, void *data) ret = client_cmd_to_gf_cmd(args->cmd, &gf_cmd); if (ret) { op_errno = EINVAL; - gf_msg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_INVALID_ENTRY, - "Unknown cmd (%d)!", gf_cmd); + gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_UNKNOWN_CMD, + "gf_cmd=%d", gf_cmd, NULL); goto unwind; } @@ -4695,14 +4737,21 @@ client4_0_lk(call_frame_t *frame, xlator_t *this, void *data) args->xdata); if (ret) { op_errno = -ret; + + if ((op_errno == EBADF) && (args->flock->l_type == F_UNLCK) && + client_is_setlk(local->cmd)) { + client_add_lock_for_recovery(local->fd, args->flock, &local->owner, + local->cmd); + } + goto unwind; } + ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_LK, - client4_0_lk_cbk, NULL, NULL, 0, NULL, 0, NULL, + client4_0_lk_cbk, NULL, (xdrproc_t)xdr_gfx_lk_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4741,11 +4790,10 @@ client4_0_inodelk(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_INODELK, - client4_0_inodelk_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_inodelk_req); + client4_0_inodelk_cbk, NULL, + (xdrproc_t)xdr_gfx_inodelk_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4791,11 +4839,10 @@ client4_0_finodelk(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FINODELK, - client4_0_finodelk_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_finodelk_req); + client4_0_finodelk_cbk, NULL, + (xdrproc_t)xdr_gfx_finodelk_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4836,11 +4883,10 @@ client4_0_entrylk(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ENTRYLK, - client4_0_entrylk_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_entrylk_req); + client4_0_entrylk_cbk, NULL, + (xdrproc_t)xdr_gfx_entrylk_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4880,11 +4926,10 @@ client4_0_fentrylk(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FENTRYLK, - client4_0_fentrylk_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_fentrylk_req); + client4_0_fentrylk_cbk, NULL, + (xdrproc_t)xdr_gfx_fentrylk_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -4922,6 +4967,7 @@ client4_0_readdir(call_frame_t *frame, xlator_t *this, void *data) {0}, }; int readdir_rsp_size = 0; + client_payload_t cp; if (!frame || !this || !data) goto unwind; @@ -4975,14 +5021,17 @@ client4_0_readdir(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } + memset(&cp, 0, sizeof(client_payload_t)); + + cp.rsphdr = rsphdr; + cp.rsphdr_cnt = count; + cp.rsp_iobref = rsp_iobref; ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIR, - client4_0_readdir_cbk, NULL, rsphdr, count, - NULL, 0, rsp_iobref, + client4_0_readdir_cbk, &cp, (xdrproc_t)xdr_gfx_readdir_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -5023,6 +5072,7 @@ client4_0_readdirp(call_frame_t *frame, xlator_t *this, void *data) {0}, }; clnt_local_t *local = NULL; + client_payload_t cp; if (!frame || !this || !data) goto unwind; @@ -5076,13 +5126,16 @@ client4_0_readdirp(call_frame_t *frame, xlator_t *this, void *data) local->fd = fd_ref(args->fd); + memset(&cp, 0, sizeof(client_payload_t)); + + cp.rsphdr = rsphdr; + cp.rsphdr_cnt = count; + cp.rsp_iobref = rsp_iobref; ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_READDIRP, - client4_0_readdirp_cbk, NULL, rsphdr, count, - NULL, 0, rsp_iobref, + client4_0_readdirp_cbk, &cp, (xdrproc_t)xdr_gfx_readdirp_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -5126,11 +5179,10 @@ client4_0_setattr(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETATTR, - client4_0_setattr_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_setattr_req); + client4_0_setattr_cbk, NULL, + (xdrproc_t)xdr_gfx_setattr_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -5169,11 +5221,9 @@ client4_0_fallocate(call_frame_t *frame, xlator_t *this, void *data) ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FALLOCATE, client4_0_fallocate_cbk, - NULL, NULL, 0, NULL, 0, NULL, - (xdrproc_t)xdr_gfx_fallocate_req); + NULL, (xdrproc_t)xdr_gfx_fallocate_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -5211,11 +5261,10 @@ client4_0_discard(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_DISCARD, - client4_0_discard_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_discard_req); + client4_0_discard_cbk, NULL, + (xdrproc_t)xdr_gfx_discard_req); if (ret) - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); GF_FREE(req.xdata.pairs.pairs_val); @@ -5254,11 +5303,10 @@ client4_0_zerofill(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ZEROFILL, - client4_0_zerofill_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_zerofill_req); + client4_0_zerofill_cbk, NULL, + (xdrproc_t)xdr_gfx_zerofill_req); if (ret) - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); GF_FREE(req.xdata.pairs.pairs_val); @@ -5297,11 +5345,10 @@ client4_0_ipc(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_IPC, - client4_0_ipc_cbk, NULL, NULL, 0, NULL, 0, NULL, + client4_0_ipc_cbk, NULL, (xdrproc_t)xdr_gfx_ipc_req); if (ret) - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); GF_FREE(req.xdata.pairs.pairs_val); @@ -5342,11 +5389,10 @@ client4_0_seek(call_frame_t *frame, xlator_t *this, void *data) } ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SEEK, - client4_0_seek_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_seek_req); + client4_0_seek_cbk, NULL, + (xdrproc_t)xdr_gfx_seek_req); if (ret) - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); GF_FREE(req.xdata.pairs.pairs_val); @@ -5392,11 +5438,9 @@ client4_0_getactivelk(call_frame_t *frame, xlator_t *this, void *data) ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_GETACTIVELK, client4_0_getactivelk_cbk, - NULL, NULL, 0, NULL, 0, NULL, - (xdrproc_t)xdr_gfx_getactivelk_req); + NULL, (xdrproc_t)xdr_gfx_getactivelk_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -5448,11 +5492,9 @@ client4_0_setactivelk(call_frame_t *frame, xlator_t *this, void *data) ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_SETACTIVELK, client4_0_setactivelk_cbk, - NULL, NULL, 0, NULL, 0, NULL, - (xdrproc_t)xdr_gfx_setactivelk_req); + NULL, (xdrproc_t)xdr_gfx_setactivelk_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } clnt_setactivelk_req_cleanup_v2(&req); @@ -5496,8 +5538,8 @@ client4_rchecksum_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_rchecksum_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -5506,8 +5548,8 @@ client4_rchecksum_cbk(struct rpc_req *req, struct iovec *iov, int count, xdr_to_dict(&rsp.xdata, &xdata); out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(rchecksum, frame, rsp.op_ret, @@ -5657,8 +5699,8 @@ client4_0_put_cbk(struct rpc_req *req, struct iovec *iov, int count, ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_common_3iatt_rsp); if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); + gf_smsg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, + NULL); rsp.op_ret = -1; rsp.op_errno = EINVAL; goto out; @@ -5672,8 +5714,8 @@ client4_0_put_cbk(struct rpc_req *req, struct iovec *iov, int count, } out: if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); + gf_smsg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), + PC_MSG_REMOTE_OP_FAILED, NULL); } CLIENT_STACK_UNWIND(put, frame, rsp.op_ret, gf_error_to_errno(rsp.op_errno), @@ -5719,11 +5761,10 @@ client4_0_namelink(call_frame_t *frame, xlator_t *this, void *data) dict_to_xdr(args->xdata, &req.xdata); ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_NAMELINK, - client4_namelink_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_namelink_req); + client4_namelink_cbk, NULL, + (xdrproc_t)xdr_gfx_namelink_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); @@ -5771,8 +5812,8 @@ client4_0_icreate(call_frame_t *frame, xlator_t *this, void *data) op_errno = ESTALE; dict_to_xdr(args->xdata, &req.xdata); ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_ICREATE, - client4_icreate_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_icreate_req); + client4_icreate_cbk, NULL, + (xdrproc_t)xdr_gfx_icreate_req); if (ret) goto free_reqdata; GF_FREE(req.xdata.pairs.pairs_val); @@ -5798,6 +5839,7 @@ client4_0_put(call_frame_t *frame, xlator_t *this, void *data) int op_errno = ESTALE; int ret = 0; clnt_local_t *local = NULL; + client_payload_t cp; if (!frame || !this || !data) goto unwind; @@ -5824,9 +5866,13 @@ client4_0_put(call_frame_t *frame, xlator_t *this, void *data) goto unwind; } + memset(&cp, 0, sizeof(client_payload_t)); + + cp.iobref = args->iobref; + cp.payload = args->vector; + cp.payload_cnt = args->count; ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_PUT, - client4_0_put_cbk, args->iobref, args->vector, - args->count, NULL, 0, NULL, + client4_0_put_cbk, &cp, (xdrproc_t)xdr_gfx_put_req); if (ret) { /* @@ -5834,8 +5880,7 @@ client4_0_put(call_frame_t *frame, xlator_t *this, void *data) * do the unwind for us (see rpc_clnt_submit), so don't unwind * here in such cases. */ - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } return 0; @@ -5846,12 +5891,15 @@ unwind: } int32_t -client4_0_fsetattr(call_frame_t *frame, xlator_t *this, void *data) +client4_0_copy_file_range(call_frame_t *frame, xlator_t *this, void *data) { clnt_args_t *args = NULL; clnt_conf_t *conf = NULL; - gfx_fsetattr_req req = { - {0}, + clnt_local_t *local = NULL; + gfx_copy_file_range_req req = { + { + 0, + }, }; int op_errno = ESTALE; int ret = 0; @@ -5862,37 +5910,65 @@ client4_0_fsetattr(call_frame_t *frame, xlator_t *this, void *data) args = data; conf = this->private; - ret = client_pre_fsetattr_v2(this, &req, args->fd, args->valid, args->stbuf, - args->xdata); + ret = client_pre_copy_file_range_v2(this, &req, args->fd, args->off_in, + args->fd_out, args->off_out, args->size, + args->flags, &args->xdata); + if (ret) { op_errno = -ret; goto unwind; } - ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSETATTR, - client4_0_fsetattr_cbk, NULL, NULL, 0, NULL, 0, - NULL, (xdrproc_t)xdr_gfx_fsetattr_req); + + ret = client_fd_fop_prepare_local(frame, args->fd, req.fd_in); + if (ret) { + op_errno = -ret; + goto unwind; + } + + /* + * Since frame->local is allocated in above function call + * itself, better to use it (with the assumption that it + * has been allocated) directly instead of again calling + * client_fd_fop_prepare_local or modifying it, as doing + * so requires changes in other places as well. + */ + + local = frame->local; + local->fd_out = fd_ref(args->fd_out); + local->attempt_reopen_out = client_is_reopen_needed(args->fd_out, this, + req.fd_out); + + ret = client_submit_request(this, &req, frame, conf->fops, + GFS3_OP_COPY_FILE_RANGE, + client4_0_copy_file_range_cbk, NULL, + (xdrproc_t)xdr_gfx_copy_file_range_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + /* + * If the lower layers fail to submit a request, they'll also + * do the unwind for us (see rpc_clnt_submit), so don't unwind + * here in such cases. + */ + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); return 0; + unwind: - CLIENT_STACK_UNWIND(fsetattr, frame, -1, op_errno, NULL, NULL, NULL); + CLIENT_STACK_UNWIND(copy_file_range, frame, -1, op_errno, NULL, NULL, NULL, + NULL); GF_FREE(req.xdata.pairs.pairs_val); return 0; } int32_t -client4_0_rchecksum(call_frame_t *frame, xlator_t *this, void *data) +client4_0_fsetattr(call_frame_t *frame, xlator_t *this, void *data) { clnt_args_t *args = NULL; - int64_t remote_fd = -1; clnt_conf_t *conf = NULL; - gfx_rchecksum_req req = { + gfx_fsetattr_req req = { {0}, }; int op_errno = ESTALE; @@ -5904,240 +5980,71 @@ client4_0_rchecksum(call_frame_t *frame, xlator_t *this, void *data) args = data; conf = this->private; - CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, - unwind); - - req.len = args->len; - req.offset = args->offset; - req.fd = remote_fd; - memcpy(req.gfid, args->fd->inode->gfid, 16); - - dict_to_xdr(args->xdata, &req.xdata); - - ret = client_submit_request( - this, &req, frame, conf->fops, GFS3_OP_RCHECKSUM, client4_rchecksum_cbk, - NULL, NULL, 0, NULL, 0, NULL, (xdrproc_t)xdr_gfx_rchecksum_req); + ret = client_pre_fsetattr_v2(this, &req, args->fd, args->valid, args->stbuf, + args->xdata); + if (ret) { + op_errno = -ret; + goto unwind; + } + ret = client_submit_request(this, &req, frame, conf->fops, GFS3_OP_FSETATTR, + client4_0_fsetattr_cbk, NULL, + (xdrproc_t)xdr_gfx_fsetattr_req); if (ret) { - gf_msg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, - "failed to send the fop"); + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } GF_FREE(req.xdata.pairs.pairs_val); return 0; unwind: - CLIENT_STACK_UNWIND(rchecksum, frame, -1, op_errno, 0, NULL, NULL); + CLIENT_STACK_UNWIND(fsetattr, frame, -1, op_errno, NULL, NULL, NULL); GF_FREE(req.xdata.pairs.pairs_val); return 0; } -int -client4_0_compound_cbk(struct rpc_req *req, struct iovec *iov, int count, - void *myframe) -{ - gfx_compound_rsp rsp = { - 0, - }; - compound_args_cbk_t *args_cbk = NULL; - call_frame_t *frame = NULL; - xlator_t *this = NULL; - dict_t *xdata = NULL; - clnt_local_t *local = NULL; - int i = 0; - int length = 0; - int ret = -1; - - this = THIS; - - frame = myframe; - local = frame->local; - - if (-1 == req->rpc_status) { - rsp.op_ret = -1; - rsp.op_errno = ENOTCONN; - goto out; - } - - ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gfx_compound_rsp); - if (ret < 0) { - gf_msg(this->name, GF_LOG_ERROR, EINVAL, PC_MSG_XDR_DECODING_FAILED, - "XDR decoding failed"); - rsp.op_ret = -1; - rsp.op_errno = EINVAL; - goto out; - } - - length = local->length; - - xdr_to_dict(&rsp.xdata, &xdata); - - args_cbk = compound_args_cbk_alloc(length, xdata); - if (!args_cbk) { - rsp.op_ret = -1; - rsp.op_errno = ENOMEM; - goto out; - } - - /* TODO: see https://bugzilla.redhat.com/show_bug.cgi?id=1376328 */ - for (i = 0; i < args_cbk->fop_length; i++) { - ret = client_process_response_v2(frame, this, req, &rsp, args_cbk, i); - if (ret) { - rsp.op_ret = -1; - rsp.op_errno = -ret; - goto out; - } - } - rsp.op_ret = 0; -out: - if (rsp.op_ret == -1) { - gf_msg(this->name, GF_LOG_WARNING, gf_error_to_errno(rsp.op_errno), - PC_MSG_REMOTE_OP_FAILED, "remote operation failed"); - } - CLIENT_STACK_UNWIND(compound, frame, rsp.op_ret, - gf_error_to_errno(rsp.op_errno), args_cbk, xdata); - - client_compound_rsp_cleanup_v2(&rsp, length); - free(rsp.compound_rsp_array.compound_rsp_array_val); - - if (xdata) - dict_unref(xdata); - - compound_args_cbk_cleanup(args_cbk); - return 0; -} - -/* Brief explanation of gfs3_compound_req structure : - * 1) It consists of version of compounding. - * 2) A compound-fop enum, new enum for compound fops - * 3) A 'compound_req_arrray' structure that has - * a) array len - based on the number of fops compounded - * b) compound_req_array_val - pointer to an array of compound_req's - * 4) compound_req - structure that contains: - * a) fop enum of type glusterfs_fop_t - * b) union of structures of xdr requests of all fops. - */ - int32_t -client4_0_compound(call_frame_t *frame, xlator_t *this, void *data) +client4_0_rchecksum(call_frame_t *frame, xlator_t *this, void *data) { + clnt_args_t *args = NULL; + int64_t remote_fd = -1; clnt_conf_t *conf = NULL; - compound_args_t *c_args = data; - gfx_compound_req req = { - 0, - }; - clnt_local_t *local = NULL; - int op_errno = ENOMEM; - int ret = 0; - int i = 0; - int rsp_count = 0; - struct iovec rsp_vector[MAX_IOVEC] = { - {0}, - }; - struct iovec req_vector[MAX_IOVEC] = { - {0}, - }; - struct iovec vector[MAX_IOVEC] = { + gfx_rchecksum_req req = { {0}, }; - struct iovec *rsphdr = NULL; - struct iobref *req_iobref = NULL; - struct iobref *rsp_iobref = NULL; - struct iobref *rsphdr_iobref = NULL; - struct iobuf *rsphdr_iobuf = NULL; - int rsphdr_count = 0; - int req_count = 0; - dict_t *xdata = c_args->xdata; - - GF_ASSERT(frame); + int op_errno = ESTALE; + int ret = 0; - if (!this) + if (!frame || !this || !data) goto unwind; - memset(req_vector, 0, sizeof(req_vector)); - memset(rsp_vector, 0, sizeof(rsp_vector)); - + args = data; conf = this->private; - local = mem_get0(this->local_pool); - if (!local) { - op_errno = ENOMEM; - goto unwind; - } - frame->local = local; - - local->length = c_args->fop_length; - local->compound_args = c_args; - - rsphdr_iobref = iobref_new(); - if (rsphdr_iobref == NULL) { - goto unwind; - } - - /* TODO: what is the size we should send ? */ - rsphdr_iobuf = iobuf_get(this->ctx->iobuf_pool); - if (rsphdr_iobuf == NULL) { - goto unwind; - } - - rsphdr = &vector[0]; - rsphdr->iov_base = iobuf_ptr(rsphdr_iobuf); - rsphdr->iov_len = iobuf_pagesize(rsphdr_iobuf); - rsphdr_count = 1; - iobref_add(rsphdr_iobref, rsphdr_iobuf); - iobuf_unref(rsphdr_iobuf); - rsphdr_iobuf = NULL; - - req.compound_fop_enum = c_args->fop_enum; - req.compound_req_array.compound_req_array_len = c_args->fop_length; - req.compound_version = 0; - dict_to_xdr(xdata, &req.xdata); + CLIENT_GET_REMOTE_FD(this, args->fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, + unwind); - req.compound_req_array.compound_req_array_val = GF_CALLOC( - local->length, sizeof(compound_req_v2), gf_client_mt_compound_req_t); + req.len = args->len; + req.offset = args->offset; + req.fd = remote_fd; + memcpy(req.gfid, args->fd->inode->gfid, 16); - if (!req.compound_req_array.compound_req_array_val) { - op_errno = ENOMEM; - goto unwind; - } + dict_to_xdr(args->xdata, &req.xdata); - for (i = 0; i < local->length; i++) { - ret = client_handle_fop_requirements_v2( - this, frame, &req, local, &req_iobref, &rsp_iobref, req_vector, - rsp_vector, &req_count, &rsp_count, &c_args->req_list[i], - c_args->enum_list[i], i); - if (ret) { - op_errno = ret; - goto unwind; - } + ret = client_submit_request(this, &req, frame, conf->fops, + GFS3_OP_RCHECKSUM, client4_rchecksum_cbk, NULL, + (xdrproc_t)xdr_gfx_rchecksum_req); + if (ret) { + gf_smsg(this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED, NULL); } - local->iobref = rsp_iobref; - rsp_iobref = NULL; - - ret = client_submit_compound_request( - this, &req, frame, conf->fops, GFS3_OP_COMPOUND, client4_0_compound_cbk, - req_vector, req_count, req_iobref, rsphdr, rsphdr_count, rsp_vector, - rsp_count, local->iobref, (xdrproc_t)xdr_gfx_compound_req); - GF_FREE(req.xdata.pairs.pairs_val); - iobref_unref(rsphdr_iobref); - - compound_request_cleanup_v2(&req); return 0; unwind: - CLIENT_STACK_UNWIND(compound, frame, -1, op_errno, NULL, NULL); - - if (rsp_iobref) - iobref_unref(rsp_iobref); - - if (rsphdr_iobref) - iobref_unref(rsphdr_iobref); - + CLIENT_STACK_UNWIND(rchecksum, frame, -1, op_errno, 0, NULL, NULL); GF_FREE(req.xdata.pairs.pairs_val); - compound_request_cleanup_v2(&req); return 0; } @@ -6254,9 +6161,10 @@ rpc_clnt_procedure_t clnt4_0_fop_actors[GF_FOP_MAXVALUE] = { [GF_FOP_LEASE] = {"LEASE", client4_0_lease}, [GF_FOP_GETACTIVELK] = {"GETACTIVELK", client4_0_getactivelk}, [GF_FOP_SETACTIVELK] = {"SETACTIVELK", client4_0_setactivelk}, - [GF_FOP_COMPOUND] = {"COMPOUND", client4_0_compound}, + [GF_FOP_COMPOUND] = {"COMPOUND", NULL}, [GF_FOP_ICREATE] = {"ICREATE", client4_0_icreate}, [GF_FOP_NAMELINK] = {"NAMELINK", client4_0_namelink}, + [GF_FOP_COPY_FILE_RANGE] = {"COPY-FILE-RANGE", client4_0_copy_file_range}, }; rpc_clnt_prog_t clnt4_0_fop_prog = { |
