Backport patch to handle EOPNOTSUPP on NFS

https://gitlab.gnome.org/GNOME/libglnx/-/merge_requests/18
This commit is contained in:
Jonathan Lebon 2020-06-18 15:04:28 -04:00
parent cf1d023050
commit 8edaaf8791
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 7e3a19958e6af94b764c772a58adf47e6cc4b678 Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jonathan@jlebon.com>
Date: Tue, 16 Jun 2020 12:29:46 -0400
Subject: [PATCH] glnx-fdio: handle EOPNOTSUPP for copy_file_range
When using `copy_file_range` to target a source and dest on the same NFS
mount on some older kernel versions, it's possible that we can get
`EOPNOTSUPP` e.g. if the NFS server doesn't support server-side copy.
We hit this in the FCOS release pipeline where we run `ostree
pull-local` to pull content between two repos on the same mount from
inside an OpenShift cluster on top of RHEL7.
Nowadays, it seems like the kernel itself falls back to a more generic
version of `copy_file_range()` at least. Though to be compatible with
older kernels, let's add `EOPNOTSUPP` to the list of errors we interpret
as "cfr possibly available, but can't be done for this specific
operation".
---
libglnx/glnx-fdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libglnx/glnx-fdio.c b/libglnx/glnx-fdio.c
index 6ae6ec7..e537a9b 100644
--- a/libglnx/glnx-fdio.c
+++ b/libglnx/glnx-fdio.c
@@ -826,7 +826,7 @@ glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes)
have_cfr = 0;
try_cfr = false;
}
- else if (errno == EXDEV)
+ else if (G_IN_SET (errno, EXDEV, EOPNOTSUPP))
/* We won't try cfr again for this run, but let's be
* conservative and not mark it as available/unavailable until
* we know for sure.
--
2.26.2

View File

@ -8,7 +8,7 @@
Summary: Tool for managing bootable, immutable filesystem trees
Name: ostree
Version: 2020.3
Release: 4%{?dist}
Release: 5%{?dist}
Source0: https://github.com/ostreedev/%{name}/releases/download/v%{version}/libostree-%{version}.tar.xz
License: LGPLv2+
URL: https://ostree.readthedocs.io/en/latest/
@ -17,6 +17,7 @@ Patch0: 0001-lib-commit-Add-more-error-prefixing.patch
Patch1: 0002-lib-Rename-function-for-staging-dir-check.patch
Patch2: 0003-lib-commit-Check-that-dirent-is-a-directory-before-c.patch
Patch3: 0001-switchroot-remount-Neuter-sysroot.readonly-for-now.patch
Patch4: 0001-glnx-fdio-handle-EOPNOTSUPP-for-copy_file_range.patch
BuildRequires: git
# We always run autogen.sh
@ -167,6 +168,10 @@ find %{buildroot} -name '*.la' -delete
%endif
%changelog
* Thu Jun 18 2020 Jonathan Lebon <jonathan@jlebon.com> - 2020.3-5
- Backport patch to handle EOPNOTSUPP on NFS:
https://gitlab.gnome.org/GNOME/libglnx/-/merge_requests/18
* Thu May 21 2020 Jonathan Lebon <jonathan@jlebon.com> - 2020.3-4
- Backport patch to neuter sysroot.readonly for FCOS
https://github.com/coreos/fedora-coreos-tracker/issues/488