summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/common-utils.c37
-rw-r--r--libglusterfs/src/common-utils.h3
-rw-r--r--xlators/cluster/afr/src/afr-open.c5
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c30
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c35
5 files changed, 61 insertions, 49 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 3a2e557c62b..606dda9b9a5 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -3391,3 +3391,40 @@ gf_backtrace_save (char *buf)
gf_log (THIS->name, GF_LOG_WARNING, "Failed to save the backtrace.");
return NULL;
}
+
+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;
+}
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index a669e741e9a..0d5abb42ec2 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -650,4 +650,7 @@ gf_backtrace_save (char *buf);
void
gf_backtrace_done (char *buf);
+
+gf_loglevel_t
+fop_log_level (glusterfs_fop_t fop, int op_errno);
#endif /* _COMMON_UTILS_H */
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
index f96f41c0dd9..f8ad8544e10 100644
--- a/xlators/cluster/afr/src/afr-open.c
+++ b/xlators/cluster/afr/src/afr-open.c
@@ -186,8 +186,9 @@ afr_openfd_fix_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
"successfully on subvolume %s", local->loc.path,
priv->children[child_index]->name);
} else {
- gf_msg (this->name, GF_LOG_ERROR, op_errno, AFR_MSG_OPEN_FAIL,
- "Failed to open %s on subvolume %s", local->loc.path,
+ gf_msg (this->name, fop_log_level (GF_FOP_OPEN, op_errno),
+ op_errno, AFR_MSG_OPEN_FAIL, "Failed to open %s on "
+ "subvolume %s", local->loc.path,
priv->children[child_index]->name);
}
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,