summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-10-10 09:51:28 +0530
committerVijay Bellur <vbellur@redhat.com>2014-10-20 22:53:12 -0700
commit5ac067e560696410c059b21ca039f74687c62e7a (patch)
tree93d27336473c4a4d5dd8ef69965f3caaf6a59e5b /xlators/protocol
parente4d25d50b58d3ee08453492852b79425c398aa05 (diff)
logs: Do selective logging for errnos
Problem: Just after replace-brick the mount logs are filled with ENOENT/ESTALE warning logs because the file is yet to be self-healed now that the brick is new. Fix: Do conditional logging for the logs. ENOENT/ESTALE will be logged at lower log level. Only when debug logs are enabled, these logs will be written to the logfile. Change-Id: If203d09e2479e8c2415ebc14fb79d4fbb81dfc95 BUG: 1151303 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8918 Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c30
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c35
2 files changed, 18 insertions, 47 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index d02206b3ed9..5fe3f05e136 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -442,7 +442,8 @@ client3_3_open_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, fop_log_level (GF_FOP_OPEN,
+ gf_error_to_errno (rsp.op_errno)),
"remote operation failed: %s. Path: %s (%s)",
strerror (gf_error_to_errno (rsp.op_errno)),
local->loc.path, loc_gfid_utoa (&local->loc));
@@ -907,7 +908,8 @@ client3_3_flush_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, fop_log_level (GF_FOP_FLUSH,
+ gf_error_to_errno (rsp.op_errno)),
"remote operation failed: %s",
strerror (gf_error_to_errno (rsp.op_errno)));
}
@@ -1517,9 +1519,10 @@ client3_3_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
rsp.op_errno, out);
out:
- if ((rsp.op_ret == -1) &&
- (EAGAIN != gf_error_to_errno (rsp.op_errno))) {
- gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+ if (rsp.op_ret == -1) {
+ gf_log (this->name, fop_log_level (GF_FOP_INODELK,
+ gf_error_to_errno (rsp.op_errno)),
+ "remote operation failed: %s",
strerror (gf_error_to_errno (rsp.op_errno)));
}
CLIENT_STACK_UNWIND (inodelk, frame, rsp.op_ret,
@@ -1567,9 +1570,10 @@ client3_3_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
rsp.op_errno, out);
out:
- if ((rsp.op_ret == -1) &&
- (EAGAIN != gf_error_to_errno (rsp.op_errno))) {
- gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+ if (rsp.op_ret == -1) {
+ gf_log (this->name, fop_log_level (GF_FOP_FINODELK,
+ gf_error_to_errno (rsp.op_errno)),
+ "remote operation failed: %s",
strerror (gf_error_to_errno (rsp.op_errno)));
} else if (rsp.op_ret == 0) {
if (local->attempt_reopen)
@@ -1619,9 +1623,10 @@ client3_3_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count,
rsp.op_errno, out);
out:
- if ((rsp.op_ret == -1) &&
- (EAGAIN != gf_error_to_errno (rsp.op_errno))) {
- gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+ if (rsp.op_ret == -1) {
+ gf_log (this->name, fop_log_level (GF_FOP_ENTRYLK,
+ gf_error_to_errno (rsp.op_errno)),
+ "remote operation failed: %s",
strerror (gf_error_to_errno (rsp.op_errno)));
}
@@ -2677,7 +2682,8 @@ client3_3_opendir_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, fop_log_level (GF_FOP_OPENDIR,
+ gf_error_to_errno (rsp.op_errno)),
"remote operation failed: %s. Path: %s (%s)",
strerror (gf_error_to_errno (rsp.op_errno)),
local->loc.path, loc_gfid_utoa (&local->loc));
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index 2337deb6dc1..7288fab5374 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -31,41 +31,6 @@
ret = RPCSVC_ACTOR_ERROR; \
} while (0)
-static gf_loglevel_t
-fop_log_level (glusterfs_fop_t fop, int op_errno)
-{
- //if gfid doesn't exist ESTALE comes
- if (op_errno == ENOENT || op_errno == ESTALE)
- return GF_LOG_DEBUG;
-
- if ((fop == GF_FOP_ENTRYLK) ||
- (fop == GF_FOP_FENTRYLK)||
- (fop == GF_FOP_FINODELK)||
- (fop == GF_FOP_INODELK) ||
- (fop == GF_FOP_LK)) {
- //if non-blocking lock fails EAGAIN comes
- //if locks xlator is not loaded ENOSYS comes
- if (op_errno == EAGAIN || op_errno == ENOSYS)
- return GF_LOG_DEBUG;
- }
-
- if ((fop == GF_FOP_GETXATTR) ||
- (fop == GF_FOP_FGETXATTR)) {
- if (op_errno == ENOTSUP || op_errno == ENODATA)
- return GF_LOG_DEBUG;
- }
-
- if ((fop == GF_FOP_SETXATTR) ||
- (fop == GF_FOP_FSETXATTR)||
- (fop == GF_FOP_REMOVEXATTR)||
- (fop == GF_FOP_FREMOVEXATTR)) {
- if (op_errno == ENOTSUP)
- return GF_LOG_DEBUG;
- }
-
- return GF_LOG_ERROR;
-}
-
/* Callback function section */
int
server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,