From 82babb6bcbd04ac5d05cc05f18201a3e69a9ff08 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 28 2020 09:36:53 +0000 Subject: import xfsprogs-5.0.0-2.el8 --- diff --git a/SOURCES/xfsprogs-5.1.0-mkfs-don-t-use-xfs_verify_fsbno-before-m_sb-is-fully.patch b/SOURCES/xfsprogs-5.1.0-mkfs-don-t-use-xfs_verify_fsbno-before-m_sb-is-fully.patch new file mode 100644 index 0000000..ef58f5b --- /dev/null +++ b/SOURCES/xfsprogs-5.1.0-mkfs-don-t-use-xfs_verify_fsbno-before-m_sb-is-fully.patch @@ -0,0 +1,60 @@ +From 9c726ef0d2d829ae83756d3817f271e9c2c8777a Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Wed, 10 Jul 2019 11:35:07 -0400 +Subject: [PATCH] mkfs: don't use xfs_verify_fsbno() before m_sb is fully set + up + +Commit 8da5298 mkfs: validate start and end of aligned logs stopped +open-coding log end block checks, and used xfs_verify_fsbno() instead. +It also used xfs_verify_fsbno() to validate the log start. This +seemed to make sense, but then xfs/306 started failing on 4k sector +filesystems, which leads to a log striep unite being set on a single +AG filesystem. + +As it turns out, if xfs_verify_fsbno() is testing a block in the +last AG, it needs to have mp->m_sb.sb_dblocks set, which isn't done +until later. With sb_dblocks unset we can't know how many blocks +are in the last AG, and hence can't validate it. + +To fix all this, go back to open-coding the checks; note that this +/does/ rely on m_sb.sb_agblklog being set, but that /is/ already +done in the early call to start_superblock_setup(). + +Fixes: 8da5298 ("mkfs: validate start and end of aligned logs") +Reported-by: Dave Chinner +Signed-off-by: Eric Sandeen +Reviewed-by: Darrick J. Wong +Signed-off-by: Eric Sandeen +--- + mkfs/xfs_mkfs.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c +index 468b8fde..4e576a5c 100644 +--- a/mkfs/xfs_mkfs.c ++++ b/mkfs/xfs_mkfs.c +@@ -3040,7 +3040,7 @@ align_internal_log( + cfg->logstart = ((cfg->logstart + (sunit - 1)) / sunit) * sunit; + + /* If our log start overlaps the next AG's metadata, fail. */ +- if (!xfs_verify_fsbno(mp, cfg->logstart)) { ++ if (XFS_FSB_TO_AGBNO(mp, cfg->logstart) <= XFS_AGFL_BLOCK(mp)) { + fprintf(stderr, + _("Due to stripe alignment, the internal log start (%lld) cannot be aligned\n" + "within an allocation group.\n"), +@@ -3051,10 +3051,9 @@ _("Due to stripe alignment, the internal log start (%lld) cannot be aligned\n" + /* round up/down the log size now */ + align_log_size(cfg, sunit); + +- /* check the aligned log still fits in an AG. */ ++ /* check the aligned log still starts and ends in the same AG. */ + logend = cfg->logstart + cfg->logblocks - 1; +- if (XFS_FSB_TO_AGNO(mp, cfg->logstart) != XFS_FSB_TO_AGNO(mp, logend) || +- !xfs_verify_fsbno(mp, logend)) { ++ if (XFS_FSB_TO_AGNO(mp, cfg->logstart) != XFS_FSB_TO_AGNO(mp, logend)) { + fprintf(stderr, + _("Due to stripe alignment, the internal log size (%lld) is too large.\n" + "Must fit within an allocation group.\n"), +-- +2.17.0 + diff --git a/SOURCES/xfsprogs-5.1.0-mkfs-validate-start-and-end-of-aligned-logs.patch b/SOURCES/xfsprogs-5.1.0-mkfs-validate-start-and-end-of-aligned-logs.patch new file mode 100644 index 0000000..7fd0b7e --- /dev/null +++ b/SOURCES/xfsprogs-5.1.0-mkfs-validate-start-and-end-of-aligned-logs.patch @@ -0,0 +1,52 @@ +From 8da52988ad210958f21c178620bb1e44f1188cd0 Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Tue, 25 Jun 2019 17:04:42 -0400 +Subject: [PATCH] mkfs: validate start and end of aligned logs + +Validate that the start and end of the log stay within a single AG if +we adjust either end to align to stripe units. + +Signed-off-by: Darrick J. Wong +Reviewed-by: Eric Sandeen +Signed-off-by: Eric Sandeen +--- + mkfs/xfs_mkfs.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c +index ddb25ecc..468b8fde 100644 +--- a/mkfs/xfs_mkfs.c ++++ b/mkfs/xfs_mkfs.c +@@ -3033,15 +3033,28 @@ align_internal_log( + struct xfs_mount *mp, + int sunit) + { ++ uint64_t logend; ++ + /* round up log start if necessary */ + if ((cfg->logstart % sunit) != 0) + cfg->logstart = ((cfg->logstart + (sunit - 1)) / sunit) * sunit; + ++ /* If our log start overlaps the next AG's metadata, fail. */ ++ if (!xfs_verify_fsbno(mp, cfg->logstart)) { ++ fprintf(stderr, ++_("Due to stripe alignment, the internal log start (%lld) cannot be aligned\n" ++ "within an allocation group.\n"), ++ (long long) cfg->logstart); ++ usage(); ++ } ++ + /* round up/down the log size now */ + align_log_size(cfg, sunit); + + /* check the aligned log still fits in an AG. */ +- if (cfg->logblocks > cfg->agsize - XFS_FSB_TO_AGBNO(mp, cfg->logstart)) { ++ logend = cfg->logstart + cfg->logblocks - 1; ++ if (XFS_FSB_TO_AGNO(mp, cfg->logstart) != XFS_FSB_TO_AGNO(mp, logend) || ++ !xfs_verify_fsbno(mp, logend)) { + fprintf(stderr, + _("Due to stripe alignment, the internal log size (%lld) is too large.\n" + "Must fit within an allocation group.\n"), +-- +2.17.0 + diff --git a/SOURCES/xfsprogs-5.1.0-xfsprogs-Fix-uninitialized-cfg-lsunit.patch b/SOURCES/xfsprogs-5.1.0-xfsprogs-Fix-uninitialized-cfg-lsunit.patch new file mode 100644 index 0000000..49f2d34 --- /dev/null +++ b/SOURCES/xfsprogs-5.1.0-xfsprogs-Fix-uninitialized-cfg-lsunit.patch @@ -0,0 +1,42 @@ +From 59cf967983f6aaff4ce33a50135ae57032ebd8f2 Mon Sep 17 00:00:00 2001 +From: Allison Collins +Date: Wed, 10 Jul 2019 11:38:04 -0400 +Subject: [PATCH] xfsprogs: Fix uninitialized cfg->lsunit + +While investigating another mkfs bug, noticed that cfg->lsunit is sometimes +left uninitialized when it should not. This is because calc_stripe_factors +in some cases needs cfg->loginternal to be set first. This is done in +validate_logdev. So move calc_stripe_factors below validate_logdev while +parsing configs. + +Signed-off-by: Allison Collins +Reviewed-by: Darrick J. Wong +Reviewed-by: Carlos Maiolino +Signed-off-by: Eric Sandeen +--- + mkfs/xfs_mkfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c +index 79377b12..65cf1e0f 100644 +--- a/mkfs/xfs_mkfs.c ++++ b/mkfs/xfs_mkfs.c +@@ -4007,7 +4007,6 @@ main( + cfg.rtblocks = calc_dev_size(cli.rtsize, &cfg, &ropts, R_SIZE, "rt"); + + validate_rtextsize(&cfg, &cli, &ft); +- calc_stripe_factors(&cfg, &cli, &ft); + + /* + * Open and validate the device configurations +@@ -4017,6 +4016,7 @@ main( + validate_datadev(&cfg, &cli); + validate_logdev(&cfg, &cli, &logfile); + validate_rtdev(&cfg, &cli, &rtfile); ++ calc_stripe_factors(&cfg, &cli, &ft); + + /* + * At this point when know exactly what size all the devices are, +-- +2.17.0 + diff --git a/SOURCES/xfsprogs-5.3.0-xfs_growfs-allow-mounted-device-node-as-argument.patch b/SOURCES/xfsprogs-5.3.0-xfs_growfs-allow-mounted-device-node-as-argument.patch new file mode 100644 index 0000000..abf76d8 --- /dev/null +++ b/SOURCES/xfsprogs-5.3.0-xfs_growfs-allow-mounted-device-node-as-argument.patch @@ -0,0 +1,70 @@ +From 7e8275f8939988f18f9a4a596381ca215fde2270 Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Mon, 4 Nov 2019 15:35:49 -0500 +Subject: [PATCH] xfs_growfs: allow mounted device node as argument + +Up until: + + b97815a0 xfs_growfs: ensure target path is an active xfs mountpoint + +xfs_growfs actually accepted a mounted block device name as the +primary argument, because it could be found in the mount table. + +It turns out that Ansible was making use of this undocumented behavior, +and it's trivial to allow it, so put it back in place and document +it this time. + +Signed-off-by: Eric Sandeen +Reviewed-by: Christoph Hellwig +Signed-off-by: Eric Sandeen +--- + growfs/xfs_growfs.c | 3 +++ + man/man8/xfs_growfs.8 | 10 +++++++++- + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c +index eab15984..6c62833b 100644 +--- a/growfs/xfs_growfs.c ++++ b/growfs/xfs_growfs.c +@@ -141,6 +141,9 @@ main(int argc, char **argv) + } + + fs = fs_table_lookup_mount(rpath); ++ if (!fs) ++ fs = fs_table_lookup_blkdev(rpath); ++ + if (!fs) { + fprintf(stderr, _("%s: %s is not a mounted XFS filesystem\n"), + progname, argv[optind]); +diff --git a/man/man8/xfs_growfs.8 b/man/man8/xfs_growfs.8 +index 7e6a387c..60a88189 100644 +--- a/man/man8/xfs_growfs.8 ++++ b/man/man8/xfs_growfs.8 +@@ -35,7 +35,12 @@ xfs_growfs \- expand an XFS filesystem + .B \-R + .I size + ] ++[ + .I mount-point ++| ++.I block-device ++] ++ + .br + .B xfs_growfs \-V + .SH DESCRIPTION +@@ -45,7 +50,10 @@ expands an existing XFS filesystem (see + The + .I mount-point + argument is the pathname of the directory where the filesystem +-is mounted. The filesystem must be mounted to be grown (see ++is mounted. The ++.I block-device ++argument is the device name of a mounted XFS filesystem. ++The filesystem must be mounted to be grown (see + .BR mount (8)). + The existing contents of the filesystem are undisturbed, and the added space + becomes available for additional file storage. +-- +2.17.0 + diff --git a/SPECS/xfsprogs.spec b/SPECS/xfsprogs.spec index f79ce56..22dfba7 100644 --- a/SPECS/xfsprogs.spec +++ b/SPECS/xfsprogs.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing the XFS filesystem Name: xfsprogs Version: 5.0.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL+ and LGPLv2+ Group: System Environment/Base URL: https://xfs.wiki.kernel.org @@ -18,6 +18,10 @@ Conflicts: xfsdump < 3.0.1 # reflink is not yet default upstream, but we enabled it as such Patch0: xfsprogs-4.17.0-reflink-default.patch +Patch1: xfsprogs-5.1.0-mkfs-validate-start-and-end-of-aligned-logs.patch +Patch2: xfsprogs-5.1.0-mkfs-don-t-use-xfs_verify_fsbno-before-m_sb-is-fully.patch +Patch3: xfsprogs-5.1.0-xfsprogs-Fix-uninitialized-cfg-lsunit.patch +Patch4: xfsprogs-5.3.0-xfs_growfs-allow-mounted-device-node-as-argument.patch %description A set of commands to use the XFS filesystem, including mkfs.xfs. @@ -49,6 +53,10 @@ also want to install xfsprogs. %setup -q %patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build export tagname=CC @@ -108,6 +116,10 @@ rm -rf $RPM_BUILD_ROOT/%{_mandir}/man8/xfs_scrub* %{_libdir}/*.so %changelog +* Sat Dec 14 2019 Eric Sandeen 5.0.0-2 +- mkfs.xfs: validate log stripe unit alignment (#1632596) +- xfs_growfs: allow mounted device node as argument (#1765217) + * Tue May 21 2019 Eric Sandeen 5.0.0-1 - New upstream version (#1712147) - mkfs.xfs: validate extent size hint parameters (#1683007)