diff --git a/SOURCES/xfsprogs-5.0.0-xfs_db-metadump-should-handle-symlinks-properly.patch b/SOURCES/xfsprogs-5.0.0-xfs_db-metadump-should-handle-symlinks-properly.patch new file mode 100644 index 0000000..a753717 --- /dev/null +++ b/SOURCES/xfsprogs-5.0.0-xfs_db-metadump-should-handle-symlinks-properly.patch @@ -0,0 +1,105 @@ +From 0e81250e5125dc664e1938288e47ff52b1cacbe4 Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Fri, 26 Apr 2019 15:40:28 -0500 +Subject: [PATCH] xfs_db: metadump should handle symlinks properly + +Remote symlink target blocks are multi-fsb objects on XFS v5 filesystems +because we only write one rmt header per data fork extent. For fs +blocksize >= 2048 we never have more than one block and therefore nobody +noticed, but for blocksize == 1024 this is definitely not true and leads +to metadump spraying error messages about symlink block crc errors. +Therefore, reformulate the symlink metadump into a multi-fsb dump +function. + +Signed-off-by: Darrick J. Wong +Reviewed-by: Eric Sandeen +[sandeen: shrink the map declaration] +Signed-off-by: Eric Sandeen +--- + db/metadump.c | 43 ++++++++++++++++++++++++++++++++++++------- + 1 file changed, 36 insertions(+), 7 deletions(-) + +Index: xfsprogs-4.5.0/db/metadump.c +=================================================================== +--- xfsprogs-4.5.0.orig/db/metadump.c ++++ xfsprogs-4.5.0/db/metadump.c +@@ -1425,11 +1425,34 @@ process_dir_data_block( + } + } + +-static void ++static int + process_symlink_block( +- char *block) ++ xfs_fileoff_t o, ++ xfs_fsblock_t s, ++ xfs_filblks_t c, ++ typnm_t btype, ++ xfs_fileoff_t last) + { +- char *link = block; ++ struct bbmap map; ++ char *link; ++ int ret = 0; ++ ++ push_cur(); ++ map.nmaps = 1; ++ map.b[0].bm_bn = XFS_FSB_TO_DADDR(mp, s); ++ map.b[0].bm_len = XFS_FSB_TO_BB(mp, c); ++ set_cur(&typtab[btype], 0, 0, DB_RING_IGN, &map); ++ if (!iocur_top->data) { ++ xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, s); ++ xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp, s); ++ ++ print_warning("cannot read %s block %u/%u (%llu)", ++ typtab[btype].name, agno, agbno, s); ++ if (stop_on_read_error) ++ ret = -1; ++ goto out_pop; ++ } ++ link = iocur_top->data; + + if (xfs_sb_version_hascrc(&(mp)->m_sb)) + link += sizeof(struct xfs_dsymlink_hdr); +@@ -1447,6 +1470,12 @@ process_symlink_block( + if (zlen < mp->m_sb.sb_blocksize) + memset(link + linklen, 0, zlen); + } ++ ++ iocur_top->need_crc = 1; ++ ret = write_buf(iocur_top); ++out_pop: ++ pop_cur(); ++ return ret; + } + + #define MAX_REMOTE_VALS 4095 +@@ -1663,10 +1692,6 @@ process_single_fsb_objects( + last == mp->m_dir_geo->fsbcount); + iocur_top->need_crc = 1; + break; +- case TYP_SYMLINK: +- process_symlink_block(dp); +- iocur_top->need_crc = 1; +- break; + case TYP_ATTR: + process_attr_block(dp, o); + iocur_top->need_crc = 1; +@@ -1764,6 +1789,8 @@ is_multi_fsb_object( + { + if (btype == TYP_DIR2 && mp->m_dir_geo->fsbcount > 1) + return true; ++ if (btype == TYP_SYMLINK) ++ return true; + return false; + } + +@@ -1778,6 +1805,8 @@ process_multi_fsb_objects( + switch (btype) { + case TYP_DIR2: + return process_multi_fsb_dir(o, s, c, btype, last); ++ case TYP_SYMLINK: ++ return process_symlink_block(o, s, c, btype, last); + default: + print_warning("bad type for multi-fsb object %d", btype); + return -EINVAL; diff --git a/SOURCES/xfsprogs-5.0.0-xfs_db-refactor-metadump-handling-of-multi-fsb-objec.patch b/SOURCES/xfsprogs-5.0.0-xfs_db-refactor-metadump-handling-of-multi-fsb-objec.patch new file mode 100644 index 0000000..30d2d97 --- /dev/null +++ b/SOURCES/xfsprogs-5.0.0-xfs_db-refactor-metadump-handling-of-multi-fsb-objec.patch @@ -0,0 +1,67 @@ +From 9e43c34535bb72edc4a3a30e14b7d22b54c468cb Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Fri, 26 Apr 2019 15:40:19 -0500 +Subject: [PATCH] xfs_db: refactor metadump handling of multi-fsb objects + +Separate the multi-fsb object dispatch from actual dir block processing +so that we can implement symlink handling correctly as a multi-fsb file. + +Signed-off-by: Darrick J. Wong +Reviewed-by: Eric Sandeen +Signed-off-by: Eric Sandeen +--- + db/metadump.c | 27 ++++++++++++++++++--------- + 1 file changed, 18 insertions(+), 9 deletions(-) + +Index: xfsprogs-4.5.0/db/metadump.c +=================================================================== +--- xfsprogs-4.5.0.orig/db/metadump.c ++++ xfsprogs-4.5.0/db/metadump.c +@@ -1695,7 +1695,7 @@ static struct bbmap mfsb_map; + static int mfsb_length; + + static int +-process_multi_fsb_objects( ++process_multi_fsb_dir( + xfs_fileoff_t o, + xfs_fsblock_t s, + xfs_filblks_t c, +@@ -1704,14 +1704,6 @@ process_multi_fsb_objects( + { + int ret = 0; + +- switch (btype) { +- case TYP_DIR2: +- break; +- default: +- print_warning("bad type for multi-fsb object %d", btype); +- return -EINVAL; +- } +- + while (c > 0) { + unsigned int bm_len; + +@@ -1765,6 +1757,23 @@ out_pop: + return ret; + } + ++static int ++process_multi_fsb_objects( ++ xfs_fileoff_t o, ++ xfs_fsblock_t s, ++ xfs_filblks_t c, ++ typnm_t btype, ++ xfs_fileoff_t last) ++{ ++ switch (btype) { ++ case TYP_DIR2: ++ return process_multi_fsb_dir(o, s, c, btype, last); ++ default: ++ print_warning("bad type for multi-fsb object %d", btype); ++ return -EINVAL; ++ } ++} ++ + /* inode copy routines */ + static int + process_bmbt_reclist( diff --git a/SOURCES/xfsprogs-5.0.0-xfs_db-refactor-multi-fsb-object-detection-decision-.patch b/SOURCES/xfsprogs-5.0.0-xfs_db-refactor-multi-fsb-object-detection-decision-.patch new file mode 100644 index 0000000..cf5ec2b --- /dev/null +++ b/SOURCES/xfsprogs-5.0.0-xfs_db-refactor-multi-fsb-object-detection-decision-.patch @@ -0,0 +1,64 @@ +From 001df390de88731675adae166db5f189924b107f Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Fri, 26 Apr 2019 15:40:24 -0500 +Subject: [PATCH] xfs_db: refactor multi-fsb object detection decision making + +Pull the "is this a multi-fsb object" decision into a separate function +that we can keep close to the actual multi-fsb object dispatcher. We +will soon make the machinery more complex so we do this to avoid having +a big hairy if statement. + +Signed-off-by: Darrick J. Wong +Reviewed-by: Eric Sandeen +Signed-off-by: Eric Sandeen +--- + db/metadump.c | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +Index: xfsprogs-4.5.0/db/metadump.c +=================================================================== +--- xfsprogs-4.5.0.orig/db/metadump.c ++++ xfsprogs-4.5.0/db/metadump.c +@@ -1757,6 +1757,16 @@ out_pop: + return ret; + } + ++static bool ++is_multi_fsb_object( ++ struct xfs_mount *mp, ++ typnm_t btype) ++{ ++ if (btype == TYP_DIR2 && mp->m_dir_geo->fsbcount > 1) ++ return true; ++ return false; ++} ++ + static int + process_multi_fsb_objects( + xfs_fileoff_t o, +@@ -1789,6 +1799,7 @@ process_bmbt_reclist( + xfs_fileoff_t last; + xfs_agnumber_t agno; + xfs_agblock_t agbno; ++ bool is_multi_fsb = is_multi_fsb_object(mp, btype); + int error; + + if (btype == TYP_DATA) +@@ -1852,11 +1863,12 @@ process_bmbt_reclist( + } + + /* multi-extent blocks require special handling */ +- if (btype != TYP_DIR2 || mp->m_dir_geo->fsbcount == 1) { +- error = process_single_fsb_objects(o, s, c, btype, last); +- } else { +- error = process_multi_fsb_objects(o, s, c, btype, last); +- } ++ if (is_multi_fsb) ++ error = process_multi_fsb_objects(o, s, c, btype, ++ last); ++ else ++ error = process_single_fsb_objects(o, s, c, btype, ++ last); + if (error) + return 0; + } diff --git a/SOURCES/xfsprogs-5.4.0-mkfs-Break-block-discard-into-chunks-of-2-GB.patch b/SOURCES/xfsprogs-5.4.0-mkfs-Break-block-discard-into-chunks-of-2-GB.patch new file mode 100644 index 0000000..fb63fcb --- /dev/null +++ b/SOURCES/xfsprogs-5.4.0-mkfs-Break-block-discard-into-chunks-of-2-GB.patch @@ -0,0 +1,89 @@ +From 7e8a6edb4d1ba0079152eb477abbbc1dfb1ebb7e Mon Sep 17 00:00:00 2001 +From: Pavel Reichl +Date: Fri, 13 Dec 2019 16:21:26 -0500 +Subject: [PATCH] mkfs: Break block discard into chunks of 2 GB + +Some users are not happy about the BLKDISCARD taking too long and at the +same time not being informed about that - so they think that the command +actually hung. + +This commit changes code so that progress reporting is possible and also +typing the ^C will cancel the ongoing BLKDISCARD. + +Signed-off-by: Pavel Reichl +Reviewed-by: Darrick J. Wong +Reviewed-by: Dave Chinner +Signed-off-by: Eric Sandeen +--- + mkfs/xfs_mkfs.c | 50 ++++++++++++++++++++++++++++++++++++------------- + 1 file changed, 37 insertions(+), 13 deletions(-) + +Index: xfsprogs-4.5.0/mkfs/xfs_mkfs.c +=================================================================== +--- xfsprogs-4.5.0.orig/mkfs/xfs_mkfs.c ++++ xfsprogs-4.5.0/mkfs/xfs_mkfs.c +@@ -875,17 +875,41 @@ done: + } + + static void +-discard_blocks(dev_t dev, __uint64_t nsectors) ++discard_blocks(dev_t dev, __uint64_t nsectors, int quiet) + { +- int fd; ++ int fd; ++ uint64_t offset = 0; ++ /* Discard the device 2G at a time */ ++ const __uint64_t step = 2ULL << 30; ++ const __uint64_t count = BBTOB(nsectors); + +- /* +- * We intentionally ignore errors from the discard ioctl. It is +- * not necessary for the mkfs functionality but just an optimization. +- */ + fd = libxfs_device_to_fd(dev); +- if (fd > 0) +- platform_discard_blocks(fd, 0, nsectors << 9); ++ if (fd <= 0) ++ return; ++ if (!quiet) { ++ printf("Discarding blocks..."); ++ fflush(stdout); ++ } ++ ++ /* The block discarding happens in smaller batches so it can be ++ * interrupted prematurely ++ */ ++ while (offset < count) { ++ __uint64_t tmp_step = min(step, count - offset); ++ ++ /* ++ * We intentionally ignore errors from the discard ioctl. It is ++ * not necessary for the mkfs functionality but just an ++ * optimization. However we should stop on error. ++ */ ++ if (platform_discard_blocks(fd, offset, tmp_step)) ++ return; ++ ++ offset += tmp_step; ++ } ++ if (!quiet) ++ printf("Done.\n"); ++ + } + + int +@@ -2140,11 +2164,11 @@ _("warning: sparse inodes not supported + } + + if (discard && !Nflag) { +- discard_blocks(xi.ddev, xi.dsize); ++ discard_blocks(xi.ddev, xi.dsize, qflag); + if (xi.rtdev) +- discard_blocks(xi.rtdev, xi.rtsize); ++ discard_blocks(xi.rtdev, xi.rtsize, qflag); + if (xi.logdev && xi.logdev != xi.ddev) +- discard_blocks(xi.logdev, xi.logBBsize); ++ discard_blocks(xi.logdev, xi.logBBsize, qflag); + } + + if (!liflag && !ldflag) diff --git a/SOURCES/xfsprogs-5.4.0-mkfs-tidy-up-discard-notifications.patch b/SOURCES/xfsprogs-5.4.0-mkfs-tidy-up-discard-notifications.patch new file mode 100644 index 0000000..6616df6 --- /dev/null +++ b/SOURCES/xfsprogs-5.4.0-mkfs-tidy-up-discard-notifications.patch @@ -0,0 +1,53 @@ +From 2383d7c5cf20efcff75cb29ca3e02cfbe1bf2209 Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Tue, 17 Dec 2019 16:52:39 -0500 +Subject: [PATCH] mkfs: tidy up discard notifications + +Only notify user of discard operations if the first one succeeds, +and be sure to print a trailing newline if we stop early. + +Signed-off-by: Eric Sandeen +Reviewed-by: Darrick J. Wong +Signed-off-by: Eric Sandeen +--- + mkfs/xfs_mkfs.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +Index: xfsprogs-4.5.0/mkfs/xfs_mkfs.c +=================================================================== +--- xfsprogs-4.5.0.orig/mkfs/xfs_mkfs.c ++++ xfsprogs-4.5.0/mkfs/xfs_mkfs.c +@@ -886,10 +886,6 @@ discard_blocks(dev_t dev, __uint64_t nse + fd = libxfs_device_to_fd(dev); + if (fd <= 0) + return; +- if (!quiet) { +- printf("Discarding blocks..."); +- fflush(stdout); +- } + + /* The block discarding happens in smaller batches so it can be + * interrupted prematurely +@@ -902,12 +898,20 @@ discard_blocks(dev_t dev, __uint64_t nse + * not necessary for the mkfs functionality but just an + * optimization. However we should stop on error. + */ +- if (platform_discard_blocks(fd, offset, tmp_step)) ++ if (platform_discard_blocks(fd, offset, tmp_step) == 0) { ++ if (offset == 0 && !quiet) { ++ printf("Discarding blocks..."); ++ fflush(stdout); ++ } ++ } else { ++ if (offset > 0 && !quiet) ++ printf("\n"); + return; ++ } + + offset += tmp_step; + } +- if (!quiet) ++ if (offset > 0 && !quiet) + printf("Done.\n"); + + } diff --git a/SOURCES/xfsprogs-5.7.0-progress-reporting-fix.patch b/SOURCES/xfsprogs-5.7.0-progress-reporting-fix.patch new file mode 100644 index 0000000..2bec365 --- /dev/null +++ b/SOURCES/xfsprogs-5.7.0-progress-reporting-fix.patch @@ -0,0 +1,64 @@ +xfs_repair: fix progress reporting + +RHEL7 note: this is a simplified version of the upstream patch. + +The Fixes: commit tried to avoid a segfault in case the progress timer +went off before the first message type had been set up, but this +had the net effect of short-circuiting the pthread start routine, +and so the timer didn't get set up at all and we lost all fine-grained +progress reporting. + +The initial problem occurred when log zeroing took more time than the +timer interval. + +[RHEL7: we do not explicitly track log zeroing, and instead lump it into +Phase 2, so the next part of the description is not relevant to this +patch.] + +So, make a new log zeroing progress item and initialize it when we first +set up the timer thread, to be sure that if the timer goes off while we +are still zeroing the log, it will be initialized and correct. + +(We can't offer fine-grained status on log zeroing, so it'll go from +zero to $LOGBLOCKS with nothing in between, but it's unlikely that log +zeroing will take so long that this really matters.) + +Reported-by: Leonardo Vaz +Fixes: 7f2d6b811755 ("xfs_repair: avoid segfault if reporting progre...") +Signed-off-by: Eric Sandeen +--- + +It might be nice to add progress reporting for the log zeroing, but that +requires renumbering all these macros, and we don't/can't actually get +any fine-grained progress at all, so probably not worth it. + +Index: xfsprogs-4.5.0/repair/progress.c +=================================================================== +--- xfsprogs-4.5.0.orig/repair/progress.c ++++ xfsprogs-4.5.0/repair/progress.c +@@ -124,7 +124,13 @@ init_progress_rpt (void) + */ + + pthread_mutex_init(&global_msgs.mutex, NULL); +- global_msgs.format = NULL; ++ /* ++ * Ensure the format string is not NULL in case the first timer ++ * goes off before any stage calls set_progress_msg() to set it. ++ * Choosing PROG_FMT_SCAN_AG lumps log zeroing in with the AG scan ++ * but that is not expected to take inordinately long. ++ */ ++ global_msgs.format = &progress_rpt_reports[PROG_FMT_SCAN_AG]; + global_msgs.count = glob_agcount; + global_msgs.interval = report_interval; + global_msgs.done = prog_rpt_done; +@@ -170,10 +176,6 @@ progress_rpt_thread (void *p) + msg_block_t *msgp = (msg_block_t *)p; + __uint64_t percent; + +- /* It's possible to get here very early w/ no progress msg set */ +- if (!msgp->format) +- return NULL; +- + if ((msgbuf = (char *)malloc(DURATION_BUF_SIZE)) == NULL) + do_error (_("progress_rpt: cannot malloc progress msg buffer\n")); + diff --git a/SOURCES/xfsprogs-RHEL7-remove-chattr-x.patch b/SOURCES/xfsprogs-RHEL7-remove-chattr-x.patch new file mode 100644 index 0000000..47b8929 --- /dev/null +++ b/SOURCES/xfsprogs-RHEL7-remove-chattr-x.patch @@ -0,0 +1,32 @@ +Index: xfsprogs-4.5.0/io/attr.c +=================================================================== +--- xfsprogs-4.5.0.orig/io/attr.c ++++ xfsprogs-4.5.0/io/attr.c +@@ -47,10 +47,9 @@ static struct xflags { + { FS_XFLAG_EXTSZINHERIT, "E", "extsz-inherit" }, + { FS_XFLAG_NODEFRAG, "f", "no-defrag" }, + { FS_XFLAG_FILESTREAM, "S", "filestream" }, +- { FS_XFLAG_DAX, "x", "dax" }, + { 0, NULL, NULL } + }; +-#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfSx" ++#define CHATTR_XFLAG_LIST "r"/*p*/"iasAdtPneEfS" + + static void + lsattr_help(void) +@@ -74,7 +73,6 @@ lsattr_help(void) + " E -- children created in this directory inherit the extent size value\n" + " f -- do not include this file when defragmenting the filesystem\n" + " S -- enable filestreams allocator for this directory\n" +-" x -- Use direct access (DAX) for data in this file\n" + "\n" + " Options:\n" + " -R -- recursively descend (useful when current file is a directory)\n" +@@ -110,7 +108,6 @@ chattr_help(void) + " +/-E -- set/clear the extent-size inheritance flag\n" + " +/-f -- set/clear the no-defrag flag\n" + " +/-S -- set/clear the filestreams allocator flag\n" +-" +/-x -- set/clear the direct access (DAX) flag\n" + " Note1: user must have certain capabilities to modify immutable/append-only.\n" + " Note2: immutable/append-only files cannot be deleted; removing these files\n" + " requires the immutable/append-only flag to be cleared first.\n" diff --git a/SPECS/xfsprogs.spec b/SPECS/xfsprogs.spec index b638f3a..fb3b907 100644 --- a/SPECS/xfsprogs.spec +++ b/SPECS/xfsprogs.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing the XFS filesystem Name: xfsprogs Version: 4.5.0 -Release: 20%{?dist} +Release: 22%{?dist} # Licensing based on generic "GNU GENERAL PUBLIC LICENSE" # in source, with no mention of version. # doc/COPYING file specifies what is GPL and what is LGPL @@ -59,7 +59,14 @@ Patch32: xfsprogs-4.18-repair-root-parent.patch Patch33: xfsprogs-4.15.0-xfs_copy-accept-CRC-version-of-ABTB_MAGIC-in-ASSERT.patch Patch34: xfsprogs-4.20-xfs_quota-fix-false-error-reporting-of-project-inhertance-flag.patch Patch35: xfsprogs-4.20-xfs_repair-initialize-non-leaf-finobt-blocks-with-co.patch - +# RHEL-7.9 +Patch36: xfsprogs-RHEL7-remove-chattr-x.patch +Patch37: xfsprogs-5.0.0-xfs_db-refactor-metadump-handling-of-multi-fsb-objec.patch +Patch38: xfsprogs-5.0.0-xfs_db-refactor-multi-fsb-object-detection-decision-.patch +Patch39: xfsprogs-5.0.0-xfs_db-metadump-should-handle-symlinks-properly.patch +Patch40: xfsprogs-5.4.0-mkfs-Break-block-discard-into-chunks-of-2-GB.patch +Patch41: xfsprogs-5.4.0-mkfs-tidy-up-discard-notifications.patch +Patch42: xfsprogs-5.7.0-progress-reporting-fix.patch %description A set of commands to use the XFS filesystem, including mkfs.xfs. @@ -122,6 +129,13 @@ also want to install xfsprogs. %patch33 -p1 %patch34 -p1 %patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 %build export tagname=CC @@ -187,6 +201,14 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/*.so %changelog +* Tue May 26 2020 2020 Eric Sandeen 4.5.0-22 +- xfs_repair: fix progress reporting (#1813557) + +* Mon May 18 2020 Eric Sandeen 4.5.0-21 +- mkfs.xfs: make device discard interruptable, print notice (#1769786) +- xfs_io: remove +/-x flag from chattr, not supported in kernel (#1630112) +- xfs_metadump: fix symlink handling (#1693138) + * Mon Feb 11 2019 Eric Sandeen 4.5.0-20 - xfs_quota: fix errors if project flag is not set on regular files (#1663502) - xfs_repair: initialize non-leaf finobt blocks with correct magic (#1670154)