From 170a3a411c88f6ce1662c55440a372f512e901d1 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 2 May 2012 11:38:33 +0530 Subject: log cleanup: in setxattr() path * in posix we log occassionally if errno is ENOTSUP, added a suggestion to mount with 'user_xattr' option. * changed server's *etxattr_cbk to log ENOTSUP in debug level. * changed client's *etxattr_cbk to log ENOTSUP in debug level. Change-Id: Icd604050aaa68546011f2c950ecd7883ac6ee820 Signed-off-by: Amar Tumballi BUG: 811957 Reviewed-on: http://review.gluster.com/3140 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Vijay Bellur --- xlators/protocol/client/src/client3_1-fops.c | 51 ++++++++++++++++------------ xlators/protocol/server/src/server3_1-fops.c | 24 ++++++++----- xlators/storage/posix/src/posix-helpers.c | 8 +++-- xlators/storage/posix/src/posix.c | 20 +++++++++-- 4 files changed, 68 insertions(+), 35 deletions(-) diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index 35e90c72379..be4322f2b3c 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -955,12 +955,12 @@ int client3_1_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - call_frame_t *frame = NULL; - gf_common_rsp rsp = {0,}; - int ret = 0; - xlator_t *this = NULL; - dict_t *xdata = NULL; - + call_frame_t *frame = NULL; + gf_common_rsp rsp = {0,}; + int ret = 0; + xlator_t *this = NULL; + dict_t *xdata = NULL; + int op_errno = EINVAL; this = THIS; @@ -985,12 +985,14 @@ client3_1_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, rsp.op_errno, out); out: + op_errno = gf_error_to_errno (rsp.op_errno); if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", - strerror (gf_error_to_errno (rsp.op_errno))); + gf_log (this->name, ((op_errno == ENOTSUP) ? + GF_LOG_DEBUG : GF_LOG_WARNING), + "remote operation failed: %s", + strerror (op_errno)); } - CLIENT_STACK_UNWIND (setxattr, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), xdata); + CLIENT_STACK_UNWIND (setxattr, frame, rsp.op_ret, op_errno, xdata); if (rsp.xdata.xdata_val) free (rsp.xdata.xdata_val); @@ -1048,7 +1050,8 @@ client3_1_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_log (this->name, ((op_errno == ENOTSUP) ? + GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s", strerror (op_errno), (local) ? local->loc.path : "--"); @@ -1117,7 +1120,8 @@ client3_1_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, out: if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, + gf_log (this->name, ((op_errno == ENOTSUP) ? + GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s", strerror (op_errno)); } @@ -1794,12 +1798,12 @@ int client3_1_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - call_frame_t *frame = NULL; - gf_common_rsp rsp = {0,}; - int ret = 0; - xlator_t *this = NULL; - dict_t *xdata = NULL; - + call_frame_t *frame = NULL; + gf_common_rsp rsp = {0,}; + int ret = 0; + xlator_t *this = NULL; + dict_t *xdata = NULL; + int op_errno = EINVAL; this = THIS; @@ -1823,12 +1827,15 @@ client3_1_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, rsp.op_errno, out); out: + op_errno = gf_error_to_errno (rsp.op_errno); if (rsp.op_ret == -1) { - gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s", - strerror (gf_error_to_errno (rsp.op_errno))); + gf_log (this->name, ((op_errno == ENOTSUP) ? + GF_LOG_DEBUG : GF_LOG_WARNING), + "remote operation failed: %s", + strerror (op_errno)); } - CLIENT_STACK_UNWIND (fsetxattr, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), xdata); + + CLIENT_STACK_UNWIND (fsetxattr, frame, rsp.op_ret, op_errno, xdata); if (rsp.xdata.xdata_val) free (rsp.xdata.xdata_val); diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index 7c64b5f9f5c..914d5160dbe 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -812,7 +812,8 @@ out: rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret == -1) - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, ((op_errno == ENOTSUP) ? + GF_LOG_DEBUG : GF_LOG_INFO), "%"PRId64": GETXATTR %s (%s) ==> %"PRId32" (%s)", frame->root->unique, state->loc.path, state->name, op_ret, strerror (op_errno)); @@ -858,7 +859,8 @@ out: rsp.op_errno = gf_errno_to_error (op_errno); if (op_ret == -1) - gf_log (this->name, GF_LOG_INFO, + gf_log (this->name, ((op_errno == ENOTSUP) ? + GF_LOG_DEBUG : GF_LOG_INFO), "%"PRId64": FGETXATTR %"PRId64" (%s) ==> %"PRId32" (%s)", frame->root->unique, state->resolve.fd_no, state->name, op_ret, strerror (op_errno)); @@ -889,12 +891,15 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); - if (op_ret == -1) - gf_log (this->name, GF_LOG_INFO, - "%"PRId64": SETXATTR %s (%s) ==> %"PRId32" (%s)", + if (op_ret == -1) { + gf_log (this->name, ((op_errno == ENOTSUP) ? + GF_LOG_DEBUG : GF_LOG_INFO), + "%"PRId64": SETXATTR %s (%s) ==> %s (%s)", frame->root->unique, state->loc.path, state->loc.inode ? uuid_utoa (state->loc.inode->gfid) : - "--", op_ret, strerror (op_errno)); + "--", state->dict->members_list->key, + strerror (op_errno)); + } GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), rsp.xdata.xdata_len, op_errno, out); @@ -926,11 +931,12 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state = CALL_STATE(frame); if (op_ret == -1) - gf_log (this->name, GF_LOG_INFO, - "%"PRId64": FSETXATTR %"PRId64" (%s) ==> %"PRId32" (%s)", + gf_log (this->name, ((op_errno == ENOTSUP) ? + GF_LOG_DEBUG : GF_LOG_INFO), + "%"PRId64": FSETXATTR %"PRId64" (%s) ==> %s (%s)", frame->root->unique, state->resolve.fd_no, state->fd ? uuid_utoa (state->fd->inode->gfid) : "--", - op_ret, strerror (op_errno)); + state->dict->members_list->key, strerror (op_errno)); GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), rsp.xdata.xdata_len, op_errno, out); diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index f4334302f27..06b5cedcb12 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -660,7 +660,9 @@ posix_handle_pair (xlator_t *this, const char *real_path, GF_LOG_OCCASIONALLY(gf_xattr_enotsup_log, this->name,GF_LOG_WARNING, "Extended attributes not " - "supported"); + "supported (try remounting " + "brick with 'user_xattr' " + "flag)"); } else if (errno == ENOENT && !posix_special_xattr (marker_xattrs, trav->key)) { @@ -707,7 +709,9 @@ posix_fhandle_pair (xlator_t *this, int fd, GF_LOG_OCCASIONALLY(gf_xattr_enotsup_log, this->name,GF_LOG_WARNING, "Extended attributes not " - "supported"); + "supported (try remounting " + "brick with 'user_xattr' " + "flag)"); } else if (errno == ENOENT) { gf_log (this->name, GF_LOG_ERROR, "fsetxattr on fd=%d failed: %s", fd, diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 447558a13ba..b92ab19e616 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -2569,6 +2569,19 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, size = sys_lgetxattr (real_path, key, NULL, 0); if (size <= 0) { op_errno = errno; + if ((op_errno == ENOTSUP) || (op_errno == ENOSYS)) { + GF_LOG_OCCASIONALLY (gf_posix_xattr_enotsup_log, + this->name, GF_LOG_WARNING, + "Extended attributes not " + "supported (try remounting" + " brick with 'user_xattr' " + "flag)"); + } else { + gf_log (this->name, GF_LOG_ERROR, + "getxattr failed on %s: %s (%s)", + real_path, key, strerror (op_errno)); + } + goto done; } value = GF_CALLOC (size + 1, sizeof(char), gf_posix_mt_char); @@ -2597,7 +2610,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, GF_LOG_OCCASIONALLY (gf_posix_xattr_enotsup_log, this->name, GF_LOG_WARNING, "Extended attributes not " - "supported."); + "supported (try remounting" + " brick with 'user_xattr' " + "flag)"); } else { gf_log (this->name, GF_LOG_ERROR, @@ -2756,7 +2771,8 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this, GF_LOG_OCCASIONALLY (gf_posix_xattr_enotsup_log, this->name, GF_LOG_WARNING, "Extended attributes not " - "supported."); + "supported (try remounting " + "brick with 'user_xattr' flag)"); } else { gf_log (this->name, GF_LOG_ERROR, -- cgit