summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavi Hernandez <xhernandez@redhat.com>2018-07-06 23:26:41 +0200
committerAmar Tumballi <amarts@redhat.com>2018-07-10 04:09:37 +0000
commit886ee4dfacdbdff68f7cf5d4938fdf1c81b98e03 (patch)
tree5ed47716762777dbcd80f96cce9f94f6a99fdfb9
parentc30283fd2786dc24b6adf5aff8d39e24730b1a11 (diff)
posix: Do not log ENXIO errors for seek fop
When lseek is used with SEEK_DATA and SEEK_HOLE, it's expected that the last operation fails with ENXIO when offset is beyond the end of file. In this case it doesn't make sense to report this as an error log message. This patch reports ENXIO failure messages for seek fops in debug level instead of error level. Change-Id: I62a4f61f99b0e4d7ea6a2cdcd40afe15072794ac fixes: bz#1598926 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
-rw-r--r--libglusterfs/src/common-utils.c6
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 66a78e9f7cb..60725769096 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -4352,6 +4352,12 @@ fop_log_level (glusterfs_fop_t fop, int op_errno)
if (op_errno == EEXIST)
return GF_LOG_DEBUG;
+ if (fop == GF_FOP_SEEK) {
+ if (op_errno == ENXIO) {
+ return GF_LOG_DEBUG;
+ }
+ }
+
return GF_LOG_ERROR;
}
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 2ebdd1a8bf1..af13a622feb 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -1111,8 +1111,9 @@ posix_seek (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
ret = sys_lseek (pfd->fd, offset, whence);
if (ret == -1) {
err = errno;
- gf_msg (this->name, GF_LOG_ERROR, err, P_MSG_SEEK_FAILED,
- "seek failed on fd %d length %" PRId64 , pfd->fd,
+ gf_msg (this->name, fop_log_level(GF_FOP_SEEK, err), err,
+ P_MSG_SEEK_FAILED,
+ "seek failed on fd %d length %" PRId64, pfd->fd,
offset);
goto out;
}