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