887953
From a064614b60924c4b0b1dbc4dd18278ce18b46db0 Mon Sep 17 00:00:00 2001
887953
From: Xavi Hernandez <xhernandez@redhat.com>
887953
Date: Fri, 6 Jul 2018 23:26:41 +0200
887953
Subject: [PATCH 462/493] posix: Do not log ENXIO errors for seek fop
887953
887953
When lseek is used with SEEK_DATA and SEEK_HOLE, it's expected that the
887953
last operation fails with ENXIO when offset is beyond the end of file.
887953
In this case it doesn't make sense to report this as an error log message.
887953
887953
This patch reports ENXIO failure messages for seek fops in debug level
887953
instead of error level.
887953
887953
> Change-Id: I62a4f61f99b0e4d7ea6a2cdcd40afe15072794ac
887953
> fixes: bz#1598926
887953
> Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
887953
887953
Upstream patch: https://review.gluster.org/c/glusterfs/+/20475
887953
Change-Id: I62a4f61f99b0e4d7ea6a2cdcd40afe15072794ac
887953
BUG: 1598883
887953
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
887953
Reviewed-on: https://code.engineering.redhat.com/gerrit/158531
887953
Tested-by: RHGS Build Bot <nigelb@redhat.com>
887953
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
887953
---
887953
 libglusterfs/src/common-utils.c   | 6 ++++++
887953
 xlators/storage/posix/src/posix.c | 3 ++-
887953
 2 files changed, 8 insertions(+), 1 deletion(-)
887953
887953
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
887953
index dd6cdb3..25600a9 100644
887953
--- a/libglusterfs/src/common-utils.c
887953
+++ b/libglusterfs/src/common-utils.c
887953
@@ -4369,6 +4369,12 @@ fop_log_level (glusterfs_fop_t fop, int op_errno)
887953
                 if (op_errno == EEXIST)
887953
                         return GF_LOG_DEBUG;
887953
 
887953
+        if (fop == GF_FOP_SEEK) {
887953
+                if (op_errno == ENXIO) {
887953
+                        return GF_LOG_DEBUG;
887953
+                }
887953
+        }
887953
+
887953
         return GF_LOG_ERROR;
887953
 }
887953
 
887953
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
887953
index e46fe99..13b4aa6 100644
887953
--- a/xlators/storage/posix/src/posix.c
887953
+++ b/xlators/storage/posix/src/posix.c
887953
@@ -1225,7 +1225,8 @@ posix_seek (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
887953
         ret = sys_lseek (pfd->fd, offset, whence);
887953
         if (ret == -1) {
887953
                 err = errno;
887953
-                gf_msg (this->name, GF_LOG_ERROR, err, P_MSG_SEEK_FAILED,
887953
+                gf_msg (this->name, fop_log_level(GF_FOP_SEEK, err), err,
887953
+                        P_MSG_SEEK_FAILED,
887953
                         "seek failed on fd %d length %" PRId64 , pfd->fd,
887953
                         offset);
887953
                 goto out;
887953
-- 
887953
1.8.3.1
887953