From b79340f6be3e2c923c8fa31ee7deea9c92616f5d Mon Sep 17 00:00:00 2001 From: zhangyaqi Date: Mon, 20 May 2024 14:26:05 +0800 Subject: [PATCH] prevent gnfs io errors on smaller files --- ...vent-gnfs-io-errors-on-smaller-files.patch | 64 +++++++++++++++++++ glusterfs.spec | 6 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 0002-prevent-gnfs-io-errors-on-smaller-files.patch diff --git a/0002-prevent-gnfs-io-errors-on-smaller-files.patch b/0002-prevent-gnfs-io-errors-on-smaller-files.patch new file mode 100644 index 0000000..6da2625 --- /dev/null +++ b/0002-prevent-gnfs-io-errors-on-smaller-files.patch @@ -0,0 +1,64 @@ +From 929d71b084e1e7f995d3a2884d16438108f6f621 Mon Sep 17 00:00:00 2001 +From: Erik Jacobson +Date: Wed, 10 Apr 2024 06:45:02 -0500 +Subject: [PATCH] prevent gnfs IO Errors on smaller files (#4322) + +In certain situations, smaller files will report I/O errors when accessed +from NFS using Gluster NFS. With our settings, files up to 170M could report +this in some cases. It was not a consistent failure. + +Disbling the NFS performance I/O cache seemed to work around the instances +of the problem observed for non-sharded volumes. + +Research showed that gluster NFS is relying on an errno return value of +EINVAL to detect EOF and set is_eof. However, in some paths this value +was not retained or was reset to zero. + +This change passes the errno along so it can be used by gluster NFS. We +found the issue in the shard xlator and the io-cache xlator. + +Signed-off-by: Erik Jacobson +Co-authored-by: Erik Jacobson + +--- + xlators/features/shard/src/shard.c | 5 ++++- + xlators/performance/io-cache/src/page.c | 4 +++- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c +index c902397..684d115 100644 +--- a/xlators/features/shard/src/shard.c ++++ b/xlators/features/shard/src/shard.c +@@ -4931,8 +4931,11 @@ shard_readv_do_cbk(call_frame_t *frame, void *cookie, xlator_t *this, + goto out; + } + +- if (local->op_ret >= 0) ++ if (local->op_ret >= 0) { + local->op_ret += op_ret; ++ /* gnfs requires op_errno to determine is_eof */ ++ local->op_errno = op_errno; ++ } + + shard_inode_ctx_get(anon_fd->inode, this, &ctx); + block_num = ctx->block_num; +diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c +index 1ef25f7..57bd244 100644 +--- a/xlators/performance/io-cache/src/page.c ++++ b/xlators/performance/io-cache/src/page.c +@@ -797,9 +797,11 @@ ioc_frame_unwind(call_frame_t *frame) + goto unwind; + } + ++ /* gnfs requires op_errno to determine is_eof */ ++ op_errno = local->op_errno; ++ + if (local->op_ret < 0) { + op_ret = local->op_ret; +- op_errno = local->op_errno; + goto unwind; + } + +-- +2.27.0 + diff --git a/glusterfs.spec b/glusterfs.spec index 5386320..0e36f32 100644 --- a/glusterfs.spec +++ b/glusterfs.spec @@ -224,7 +224,7 @@ Summary: Distributed File System Name: glusterfs Version: 11.1 -Release: 2 +Release: 3 License: GPLv3 or GPLv2+ or LGPLv3+ URL: http://docs.gluster.org/ %if ( 0%{_for_fedora_koji_builds} ) @@ -238,6 +238,7 @@ Source0: https://download.gluster.org/pub/gluster/glusterfs/11/%{versio %endif Patch1: 0001-fuse-Resolve-asan-bug-in-during-receive-event-notifi.patch +Patch2: 0002-prevent-gnfs-io-errors-on-smaller-files.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: rpcgen gperftools-devel libunwind-devel @@ -1500,6 +1501,9 @@ exit 0 %{_mandir}/man8/*gluster*.8* %changelog +* Mon May 20 2024 zhangyaqi - 11.1-3 +- fix prevent gnfs IO Errors on smaller files + * Wed Mar 13 2024 wangxiaomeng - 11.1-2 - fix upgrade error that %{_mandir}/man8/*gluster*.8* belong to package glusterfs currently conflict with that belong to package help in the lower version. -- Gitee