From 5c1287689834387553c085fd0d331c542f073523 Mon Sep 17 00:00:00 2001 From: Zhang Yaqi Date: Wed, 19 Jun 2024 10:41:31 +0800 Subject: [PATCH] prevent gnfs IO Errors on smaller files (cherry picked from commit 3dffc155c5d023cde387800250bce56019287e01) --- ...vent-gnfs-IO-Errors-on-smaller-files.patch | 63 +++++++++++++++++++ glusterfs.spec | 6 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 0004-prevent-gnfs-IO-Errors-on-smaller-files.patch diff --git a/0004-prevent-gnfs-IO-Errors-on-smaller-files.patch b/0004-prevent-gnfs-IO-Errors-on-smaller-files.patch new file mode 100644 index 0000000..5a1c830 --- /dev/null +++ b/0004-prevent-gnfs-IO-Errors-on-smaller-files.patch @@ -0,0 +1,63 @@ +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 58141db..1da7715 100644 --- a/glusterfs.spec +++ b/glusterfs.spec @@ -224,7 +224,7 @@ Summary: Distributed File System Name: glusterfs Version: 11.1 -Release: 3 +Release: 4 License: GPLv3 or GPLv2+ or LGPLv3+ URL: http://docs.gluster.org/ %if ( 0%{_for_fedora_koji_builds} ) @@ -240,6 +240,7 @@ Source0: https://download.gluster.org/pub/gluster/glusterfs/11/%{versio Patch1: 0001-fuse-Resolve-asan-bug-in-during-receive-event-notifi.patch Patch2: 0002-fix-Hostname-validation.patch Patch3: 0003-fix-mount.glusterfs-Remove-from-grep-command.patch +Patch4: 0004-prevent-gnfs-IO-Errors-on-smaller-files.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: rpcgen gperftools-devel libunwind-devel @@ -1502,6 +1503,9 @@ exit 0 %{_mandir}/man8/*gluster*.8* %changelog +* Wed Jun 19 2024 zhangyaqi - 11.1-4 +- fix prevent gnfs IO Errors on smaller files + * Wed May 22 2024 xuchenchen - 11.1-3 - fix Hostname validation - fix mount.glusterfs Remove \ from grep command -- Gitee