diff options
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r-- | libglusterfs/src/common-utils.c | 36 |
1 files changed, 36 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; +} + |