Backport several upstream fixes
Resolves: rhbz#2182361 Resolves: rhbz#2161936 Resolves: rhbz#2160746 Signed-off-by: Pavel Reichl <preichl@redhat.com>
This commit is contained in:
parent
affbb15660
commit
9388dbf231
112
xfsprogs-5.19.0-mkfs-terminate-getsubopt-arrays-properly.patch
Normal file
112
xfsprogs-5.19.0-mkfs-terminate-getsubopt-arrays-properly.patch
Normal file
@ -0,0 +1,112 @@
|
||||
From 50dba8189b1f628073eb61d824ae8a8a1b43cefb Mon Sep 17 00:00:00 2001
|
||||
From: "Darrick J. Wong" <djwong@kernel.org>
|
||||
Date: Wed, 13 Jul 2022 20:58:28 -0500
|
||||
Subject: [PATCH] mkfs: terminate getsubopt arrays properly
|
||||
|
||||
Having not drank any (or maybe too much) coffee this morning, I typed:
|
||||
|
||||
$ mkfs.xfs -d agcount=3 -d nrext64=0
|
||||
Segmentation fault
|
||||
|
||||
I traced this down to getsubopt walking off the end of the dopts.subopts
|
||||
array. The manpage says you're supposed to terminate the suboptions
|
||||
string array with a NULL entry, but the structure definition uses
|
||||
MAX_SUBOPTS/D_MAX_OPTS directly, which means there is no terminator.
|
||||
|
||||
Explicitly terminate each suboption array with a NULL entry after
|
||||
making room for it.
|
||||
|
||||
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
|
||||
[sandeen: explicitly add NULL terminators & clarify comment]
|
||||
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
|
||||
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
|
||||
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||
---
|
||||
mkfs/xfs_mkfs.c | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
|
||||
index db322b3a..b140b815 100644
|
||||
--- a/mkfs/xfs_mkfs.c
|
||||
+++ b/mkfs/xfs_mkfs.c
|
||||
@@ -140,8 +140,11 @@ enum {
|
||||
M_MAX_OPTS,
|
||||
};
|
||||
|
||||
-/* Just define the max options array size manually right now */
|
||||
-#define MAX_SUBOPTS D_MAX_OPTS
|
||||
+/*
|
||||
+ * Just define the max options array size manually to the largest
|
||||
+ * enum right now, leaving room for a NULL terminator at the end
|
||||
+ */
|
||||
+#define MAX_SUBOPTS (D_MAX_OPTS + 1)
|
||||
|
||||
#define SUBOPT_NEEDS_VAL (-1LL)
|
||||
#define MAX_CONFLICTS 8
|
||||
@@ -251,6 +254,7 @@ static struct opt_params bopts = {
|
||||
.name = 'b',
|
||||
.subopts = {
|
||||
[B_SIZE] = "size",
|
||||
+ [B_MAX_OPTS] = NULL,
|
||||
},
|
||||
.subopt_params = {
|
||||
{ .index = B_SIZE,
|
||||
@@ -306,6 +311,7 @@ static struct opt_params dopts = {
|
||||
[D_PROJINHERIT] = "projinherit",
|
||||
[D_EXTSZINHERIT] = "extszinherit",
|
||||
[D_COWEXTSIZE] = "cowextsize",
|
||||
+ [D_MAX_OPTS] = NULL,
|
||||
},
|
||||
.subopt_params = {
|
||||
{ .index = D_AGCOUNT,
|
||||
@@ -443,6 +449,7 @@ static struct opt_params iopts = {
|
||||
[I_ATTR] = "attr",
|
||||
[I_PROJID32BIT] = "projid32bit",
|
||||
[I_SPINODES] = "sparse",
|
||||
+ [I_MAX_OPTS] = NULL,
|
||||
},
|
||||
.subopt_params = {
|
||||
{ .index = I_ALIGN,
|
||||
@@ -515,6 +522,7 @@ static struct opt_params lopts = {
|
||||
[L_FILE] = "file",
|
||||
[L_NAME] = "name",
|
||||
[L_LAZYSBCNTR] = "lazy-count",
|
||||
+ [L_MAX_OPTS] = NULL,
|
||||
},
|
||||
.subopt_params = {
|
||||
{ .index = L_AGNUM,
|
||||
@@ -607,6 +615,7 @@ static struct opt_params nopts = {
|
||||
[N_SIZE] = "size",
|
||||
[N_VERSION] = "version",
|
||||
[N_FTYPE] = "ftype",
|
||||
+ [N_MAX_OPTS] = NULL,
|
||||
},
|
||||
.subopt_params = {
|
||||
{ .index = N_SIZE,
|
||||
@@ -642,6 +651,7 @@ static struct opt_params ropts = {
|
||||
[R_FILE] = "file",
|
||||
[R_NAME] = "name",
|
||||
[R_NOALIGN] = "noalign",
|
||||
+ [R_MAX_OPTS] = NULL,
|
||||
},
|
||||
.subopt_params = {
|
||||
{ .index = R_EXTSIZE,
|
||||
@@ -689,6 +699,7 @@ static struct opt_params sopts = {
|
||||
.subopts = {
|
||||
[S_SIZE] = "size",
|
||||
[S_SECTSIZE] = "sectsize",
|
||||
+ [S_MAX_OPTS] = NULL,
|
||||
},
|
||||
.subopt_params = {
|
||||
{ .index = S_SIZE,
|
||||
@@ -725,6 +736,7 @@ static struct opt_params mopts = {
|
||||
[M_REFLINK] = "reflink",
|
||||
[M_INOBTCNT] = "inobtcount",
|
||||
[M_BIGTIME] = "bigtime",
|
||||
+ [M_MAX_OPTS] = NULL,
|
||||
},
|
||||
.subopt_params = {
|
||||
{ .index = M_CRC,
|
||||
--
|
||||
2.40.1
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
From f50d3462c654acc484ab3ea68e75e8252b77e262 Mon Sep 17 00:00:00 2001
|
||||
From: "Darrick J. Wong" <djwong@kernel.org>
|
||||
Date: Wed, 13 Jul 2022 20:58:25 -0500
|
||||
Subject: [PATCH] xfs_repair: ignore empty xattr leaf blocks
|
||||
|
||||
As detailed in the commit:
|
||||
|
||||
5e572d1a xfs: empty xattr leaf header blocks are not corruption
|
||||
|
||||
empty xattr leaf blocks can be the benign byproduct of the system
|
||||
going down during the multi-step process of adding a large xattr
|
||||
to a file that has no xattrs. If we find one at attr fork offset 0,
|
||||
we should clear it, but this isn't a corruption.
|
||||
|
||||
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
|
||||
Reviewed-by: Dave Chinner <dchinner@redhat.com>
|
||||
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
|
||||
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||
---
|
||||
repair/attr_repair.c | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/repair/attr_repair.c b/repair/attr_repair.c
|
||||
index 2055d96e..c3a6d502 100644
|
||||
--- a/repair/attr_repair.c
|
||||
+++ b/repair/attr_repair.c
|
||||
@@ -579,6 +579,26 @@ process_leaf_attr_block(
|
||||
firstb = mp->m_sb.sb_blocksize;
|
||||
stop = xfs_attr3_leaf_hdr_size(leaf);
|
||||
|
||||
+ /*
|
||||
+ * Empty leaf blocks at offset zero can occur as a race between
|
||||
+ * setxattr and the system going down, so we only take action if we're
|
||||
+ * running in modify mode. See xfs_attr3_leaf_verify for details of
|
||||
+ * how we've screwed this up many times.
|
||||
+ */
|
||||
+ if (!leafhdr.count && da_bno == 0) {
|
||||
+ if (no_modify) {
|
||||
+ do_log(
|
||||
+ _("would clear empty leaf attr block 0, inode %" PRIu64 "\n"),
|
||||
+ ino);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ do_warn(
|
||||
+ _("will clear empty leaf attr block 0, inode %" PRIu64 "\n"),
|
||||
+ ino);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
/* does the count look sorta valid? */
|
||||
if (!leafhdr.count ||
|
||||
leafhdr.count * sizeof(xfs_attr_leaf_entry_t) + stop >
|
||||
--
|
||||
2.40.1
|
||||
|
||||
78
xfsprogs-5.9.0-xfs-ignore-autofs-mount-table-entries.patch
Normal file
78
xfsprogs-5.9.0-xfs-ignore-autofs-mount-table-entries.patch
Normal file
@ -0,0 +1,78 @@
|
||||
From 5ca4d781d36946de197ed2d4196c84c8f6b4522f Mon Sep 17 00:00:00 2001
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
Date: Mon, 12 Oct 2020 15:40:01 -0400
|
||||
Subject: [PATCH] xfsprogs: ignore autofs mount table entries
|
||||
|
||||
Some of the xfsprogs utilities read the mount table via. getmntent(3).
|
||||
|
||||
The mount table may contain (almost always these days since /etc/mtab is
|
||||
symlinked to /proc/self/mounts) autofs mount entries. During processing
|
||||
of the mount table entries statfs(2) can be called on mount point paths
|
||||
which will trigger an automount if those entries are direct or offset
|
||||
autofs mount triggers (indirect autofs mounts aren't affected).
|
||||
|
||||
This can be a problem when there are a lot of autofs direct or offset
|
||||
mounts because real mounts will be triggered when statfs(2) is called.
|
||||
This can be particularly bad if the triggered mounts are NFS mounts and
|
||||
the server is unavailable leading to lengthy boot times or worse.
|
||||
|
||||
Simply ignoring autofs mount entries during getmentent(3) traversals
|
||||
avoids the statfs() call that triggers these mounts. If there are
|
||||
automounted mounts (real mounts) at the time of reading the mount table
|
||||
these will still be seen in the list so they will be included if that
|
||||
actually matters to the reader.
|
||||
|
||||
Recent glibc getmntent(3) can ignore autofs mounts but that requires the
|
||||
autofs user to configure autofs to use the "ignore" pseudo mount option
|
||||
for autofs mounts. But this isn't yet the autofs default (to prevent
|
||||
unexpected side effects) so that can't be used.
|
||||
|
||||
The autofs direct and offset automount triggers are pseudo file system
|
||||
mounts and are more or less useless in terms on file system information
|
||||
so excluding them doesn't sacrifice useful file system information
|
||||
either.
|
||||
|
||||
Consequently excluding autofs mounts shouldn't have any adverse side
|
||||
effects.
|
||||
|
||||
Changes since v1:
|
||||
- drop hunk from fsr/xfs_fsr.c.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
|
||||
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
|
||||
Signed-off-by: Pavel Reichl <preichl@redhat.com>
|
||||
---
|
||||
libfrog/linux.c | 2 ++
|
||||
libfrog/paths.c | 2 ++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/libfrog/linux.c b/libfrog/linux.c
|
||||
index 40a839d1..a45d99ab 100644
|
||||
--- a/libfrog/linux.c
|
||||
+++ b/libfrog/linux.c
|
||||
@@ -73,6 +73,8 @@ platform_check_mount(char *name, char *block, struct stat *s, int flags)
|
||||
* servers. So first, a simple check: does the "dev" start with "/" ?
|
||||
*/
|
||||
while ((mnt = getmntent(f)) != NULL) {
|
||||
+ if (!strcmp(mnt->mnt_type, "autofs"))
|
||||
+ continue;
|
||||
if (mnt->mnt_fsname[0] != '/')
|
||||
continue;
|
||||
if (stat(mnt->mnt_dir, &mst) < 0)
|
||||
diff --git a/libfrog/paths.c b/libfrog/paths.c
|
||||
index 32737223..d6793764 100644
|
||||
--- a/libfrog/paths.c
|
||||
+++ b/libfrog/paths.c
|
||||
@@ -389,6 +389,8 @@ fs_table_initialise_mounts(
|
||||
return errno;
|
||||
|
||||
while ((mnt = getmntent(mtp)) != NULL) {
|
||||
+ if (!strcmp(mnt->mnt_type, "autofs"))
|
||||
+ continue;
|
||||
if (!realpath(mnt->mnt_dir, rmnt_dir))
|
||||
continue;
|
||||
if (!realpath(mnt->mnt_fsname, rmnt_fsname))
|
||||
--
|
||||
2.40.1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: Utilities for managing the XFS filesystem
|
||||
Name: xfsprogs
|
||||
Version: 5.0.0
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
License: GPL+ and LGPLv2+
|
||||
Group: System Environment/Base
|
||||
URL: https://xfs.wiki.kernel.org
|
||||
@ -80,6 +80,9 @@ Patch59: xfsprogs-5.13.0-xfs-rename-struct-xfs_legacy_ictimestamp.patch
|
||||
Patch60: xfsprogs-5.11.0-mkfs-fix-wrong-inobtcount-usage-error-output.patch
|
||||
Patch61: xfsprogs-5.12.0-libxfs-expose-inobtcount-in-xfs-geometry.patch
|
||||
Patch62: xfsprogs-5.12.0-libfrog-report-inobtcount-in-geometry.patch
|
||||
Patch63: xfsprogs-5.19.0-xfs_repair-ignore-empty-xattr-leaf-blocks.patch
|
||||
Patch64: xfsprogs-5.19.0-mkfs-terminate-getsubopt-arrays-properly.patch
|
||||
Patch65: xfsprogs-5.9.0-xfs-ignore-autofs-mount-table-entries.patch
|
||||
|
||||
%description
|
||||
A set of commands to use the XFS filesystem, including mkfs.xfs.
|
||||
@ -173,6 +176,9 @@ also want to install xfsprogs.
|
||||
%patch60 -p1
|
||||
%patch61 -p1
|
||||
%patch62 -p1
|
||||
%patch63 -p1
|
||||
%patch64 -p1
|
||||
%patch65 -p1
|
||||
|
||||
%build
|
||||
export tagname=CC
|
||||
@ -232,6 +238,10 @@ rm -rf $RPM_BUILD_ROOT/%{_mandir}/man8/xfs_scrub*
|
||||
%{_libdir}/*.so
|
||||
|
||||
%changelog
|
||||
* Tue May 02 2023 Pavel Reichl <preichl@redhat.com> - 5.0.0-11
|
||||
- Fix xfstest fails with error "missing xfsprogs fix patch"(#2161936,#2160746)
|
||||
- Fix ignore autofs mount table entries (#2182361)
|
||||
|
||||
* Thu Dec 09 2021 Bill O'Donnell <bodonnel@redhat.com> 5.0.0-10
|
||||
- xfsprogs: enable bigtime and inode btree counter features in RHEL8 (#2024201))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user