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 | 933 |
1 files changed, 341 insertions, 592 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops_v2.c b/xlators/protocol/client/src/client-rpc-fops_v2.c index 2673b6e0237..0d80d4e8efb 100644 --- a/xlators/protocol/client/src/client-rpc-fops_v2.c +++ b/xlators/protocol/client/src/client-rpc-fops_v2.c @@ -16,7 +16,6 @@ #include "client-messages.h" #include <glusterfs/defaults.h> #include "client-common.h" -#include <glusterfs/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, @@ -2868,8 +2859,8 @@ client4_0_copy_file_range_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; @@ -2881,8 +2872,8 @@ client4_0_copy_file_range_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); @@ -3010,9 +3001,6 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data) if (!frame || !this || !data) goto unwind; - memset(vector, 0, sizeof(vector)); - memset(&cp, 0, sizeof(client_payload_t)); - conf = this->private; args = data; local = mem_get0(this->local_pool); @@ -3029,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) { @@ -3045,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); @@ -3062,6 +3051,8 @@ client4_0_lookup(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 = local->iobref; @@ -3070,8 +3061,7 @@ client4_0_lookup(call_frame_t *frame, xlator_t *this, void *data) (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); @@ -3117,8 +3107,7 @@ client4_0_stat(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3161,8 +3150,7 @@ client4_0_truncate(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3205,8 +3193,7 @@ client4_0_ftruncate(call_frame_t *frame, xlator_t *this, void *data) GFS3_OP_FTRUNCATE, client4_0_ftruncate_cbk, 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); @@ -3248,8 +3235,7 @@ client4_0_access(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3302,8 +3288,7 @@ client4_0_readlink(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3345,8 +3330,7 @@ client4_0_unlink(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3388,8 +3372,7 @@ client4_0_rmdir(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3447,8 +3430,7 @@ client4_0_symlink(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3493,8 +3475,7 @@ client4_0_rename(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3553,8 +3534,7 @@ client4_0_link(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3608,8 +3588,7 @@ client4_0_mknod(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3643,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 " @@ -3675,8 +3654,7 @@ client4_0_mkdir(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3733,8 +3711,7 @@ client4_0_create(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3794,8 +3771,7 @@ client4_0_open(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3832,7 +3808,6 @@ client4_0_readv(call_frame_t *frame, xlator_t *this, void *data) if (!frame || !this || !data) goto unwind; - memset(&cp, 0, sizeof(client_payload_t)); args = data; conf = this->private; @@ -3871,13 +3846,15 @@ 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; @@ -3885,8 +3862,7 @@ client4_0_readv(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -3919,7 +3895,6 @@ client4_0_writev(call_frame_t *frame, xlator_t *this, void *data) if (!frame || !this || !data) goto unwind; - memset(&cp, 0, sizeof(client_payload_t)); args = data; conf = this->private; @@ -3937,6 +3912,8 @@ 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; @@ -3949,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); @@ -3997,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, (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); @@ -4046,8 +4028,7 @@ client4_0_fsync(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4091,8 +4072,7 @@ client4_0_fstat(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4146,8 +4126,7 @@ client4_0_opendir(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4191,8 +4170,7 @@ client4_0_fsyncdir(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4235,8 +4213,7 @@ client4_0_statfs(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4279,8 +4256,7 @@ client4_0_setxattr(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4325,8 +4301,7 @@ client4_0_fsetxattr(call_frame_t *frame, xlator_t *this, void *data) GFS3_OP_FSETXATTR, client4_0_fsetxattr_cbk, 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); @@ -4378,8 +4353,7 @@ client4_0_fgetxattr(call_frame_t *frame, xlator_t *this, void *data) GFS3_OP_FGETXATTR, client4_0_fgetxattr_cbk, 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); @@ -4442,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; } @@ -4466,8 +4439,7 @@ client4_0_getxattr(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4528,8 +4500,7 @@ client4_0_xattrop(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4580,8 +4551,7 @@ client4_0_fxattrop(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4626,8 +4596,7 @@ client4_0_removexattr(call_frame_t *frame, xlator_t *this, void *data) GFS3_OP_REMOVEXATTR, client4_0_removexattr_cbk, 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); @@ -4670,8 +4639,7 @@ client4_0_fremovexattr(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4713,8 +4681,7 @@ client4_0_lease(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4757,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; } @@ -4770,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, (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); @@ -4819,8 +4793,7 @@ client4_0_inodelk(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4869,8 +4842,7 @@ client4_0_finodelk(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4914,8 +4886,7 @@ client4_0_entrylk(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -4958,8 +4929,7 @@ client4_0_fentrylk(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -5002,7 +4972,6 @@ client4_0_readdir(call_frame_t *frame, xlator_t *this, void *data) if (!frame || !this || !data) goto unwind; - memset(&cp, 0, sizeof(client_payload_t)); args = data; conf = this->private; @@ -5052,6 +5021,8 @@ 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; @@ -5060,8 +5031,7 @@ client4_0_readdir(call_frame_t *frame, xlator_t *this, void *data) (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); @@ -5107,7 +5077,6 @@ client4_0_readdirp(call_frame_t *frame, xlator_t *this, void *data) if (!frame || !this || !data) goto unwind; - memset(&cp, 0, sizeof(client_payload_t)); args = data; conf = this->private; @@ -5157,6 +5126,8 @@ 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; @@ -5164,8 +5135,7 @@ client4_0_readdirp(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -5212,8 +5182,7 @@ client4_0_setattr(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -5254,8 +5223,7 @@ client4_0_fallocate(call_frame_t *frame, xlator_t *this, void *data) GFS3_OP_FALLOCATE, client4_0_fallocate_cbk, 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); @@ -5296,8 +5264,7 @@ client4_0_discard(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -5339,8 +5306,7 @@ client4_0_zerofill(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -5382,8 +5348,7 @@ client4_0_ipc(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -5427,8 +5392,7 @@ client4_0_seek(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -5476,8 +5440,7 @@ client4_0_getactivelk(call_frame_t *frame, xlator_t *this, void *data) GFS3_OP_GETACTIVELK, client4_0_getactivelk_cbk, 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); @@ -5531,8 +5494,7 @@ client4_0_setactivelk(call_frame_t *frame, xlator_t *this, void *data) GFS3_OP_SETACTIVELK, client4_0_setactivelk_cbk, 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); @@ -5576,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; @@ -5586,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, @@ -5737,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; @@ -5752,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), @@ -5802,8 +5764,7 @@ client4_0_namelink(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -5883,7 +5844,6 @@ client4_0_put(call_frame_t *frame, xlator_t *this, void *data) if (!frame || !this || !data) goto unwind; - memset(&cp, 0, sizeof(client_payload_t)); args = data; conf = this->private; @@ -5906,6 +5866,8 @@ 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; @@ -5918,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; @@ -5987,8 +5948,7 @@ client4_0_copy_file_range(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); @@ -6030,8 +5990,7 @@ client4_0_fsetattr(call_frame_t *frame, xlator_t *this, void *data) 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); @@ -6076,8 +6035,7 @@ client4_0_rchecksum(call_frame_t *frame, xlator_t *this, void *data) GFS3_OP_RCHECKSUM, client4_rchecksum_cbk, NULL, (xdrproc_t)xdr_gfx_rchecksum_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); @@ -6090,215 +6048,6 @@ unwind: 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) -{ - 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] = { - {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); - - if (!this) - goto unwind; - - memset(req_vector, 0, sizeof(req_vector)); - memset(rsp_vector, 0, sizeof(rsp_vector)); - - 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); - - req.compound_req_array.compound_req_array_val = GF_CALLOC( - local->length, sizeof(compound_req_v2), gf_client_mt_compound_req_t); - - if (!req.compound_req_array.compound_req_array_val) { - op_errno = ENOMEM; - goto unwind; - } - - 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; - } - } - - 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); - - GF_FREE(req.xdata.pairs.pairs_val); - - compound_request_cleanup_v2(&req); - return 0; -} - /* Used From RPC-CLNT library to log proper name of procedure based on number */ char *clnt4_0_fop_names[GFS3_OP_MAXVALUE] = { [GFS3_OP_NULL] = "NULL", @@ -6412,7 +6161,7 @@ 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}, |
