summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-10-21 16:18:16 +0530
committerNiels de Vos <ndevos@redhat.com>2014-10-22 00:32:40 -0700
commit5fff385333db750561ffd026af09e52a8c8c16e6 (patch)
treedb77cdee6977a558b2d5401c297d5c0bf5092b9b /libglusterfs
parent946eecfff75d7c9f4df3890ce57311386fe6e994 (diff)
logs: Do selective logging for errnos
Backport of http://review.gluster.org/8918 http://review.gluster.org/8955 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. BUG: 1155073 Change-Id: Icf06f2fc4f2f91e199de24a88bcb0ce9b8955ebd Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8960 Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c36
-rw-r--r--libglusterfs/src/common-utils.h2
2 files changed, 38 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index d5df2b2fedf..5424fbfb7d0 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -37,6 +37,7 @@
#include <sys/sysctl.h>
#endif
+#include "compat-errno.h"
#include "logging.h"
#include "common-utils.h"
#include "revision.h"
@@ -3215,3 +3216,38 @@ dht_is_linkfile (struct iatt *buf, dict_t *dict)
return linkfile_key_found;
}
+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 28b2836c925..26574a41ad4 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -628,4 +628,6 @@ struct _dict;
inline gf_boolean_t
dht_is_linkfile (struct iatt *buf, struct _dict *dict);
+gf_loglevel_t
+fop_log_level (glusterfs_fop_t fop, int op_errno);
#endif /* _COMMON_UTILS_H */