basebuilder_pel7x64builder0
4 years ago
10 changed files with 625 additions and 1 deletions
@ -0,0 +1,43 @@ |
|||||||
|
From b136f48b19a5b8e788aceb4b80e97d6ae9edd0ea Mon Sep 17 00:00:00 2001 |
||||||
|
From: Achilles Gaikwad <agaikwad@redhat.com> |
||||||
|
Date: Mon, 28 Jan 2019 13:03:08 -0600 |
||||||
|
Subject: [PATCH] xfs_quota: fix false error reporting of project inheritance |
||||||
|
flag is not set |
||||||
|
|
||||||
|
After kernel commit: |
||||||
|
|
||||||
|
9336e3a7 "xfs: project id inheritance is a directory only flag" |
||||||
|
|
||||||
|
xfs stopped setting the project inheritance flag on regular files, but |
||||||
|
userspace quota code still checks for it and will now issue the error: |
||||||
|
|
||||||
|
"project inheritance flag is not set" |
||||||
|
|
||||||
|
for every regular file during quotacheck. Fix this by only checking |
||||||
|
for the flag on directories. |
||||||
|
|
||||||
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1663502 |
||||||
|
Reported-by: Steven Gardner <sgardner@redhat.com> |
||||||
|
Signed-off-by: Achilles Gaikwad <agaikwad@redhat.com> |
||||||
|
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> |
||||||
|
Signed-off-by: Eric Sandeen <sandeen@sandeen.net> |
||||||
|
--- |
||||||
|
quota/project.c | 2 +- |
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-) |
||||||
|
|
||||||
|
diff --git a/quota/project.c b/quota/project.c |
||||||
|
index 78ede9e..7c22947 100644 |
||||||
|
--- a/quota/project.c |
||||||
|
+++ b/quota/project.c |
||||||
|
@@ -114,7 +114,7 @@ check_project( |
||||||
|
printf(_("%s - project identifier is not set" |
||||||
|
" (inode=%u, tree=%u)\n"), |
||||||
|
path, fsx.fsx_projid, (unsigned int)prid); |
||||||
|
- if (!(fsx.fsx_xflags & FS_XFLAG_PROJINHERIT)) |
||||||
|
+ if (!(fsx.fsx_xflags & FS_XFLAG_PROJINHERIT) && S_ISDIR(stat->st_mode)) |
||||||
|
printf(_("%s - project inheritance flag is not set\n"), |
||||||
|
path); |
||||||
|
} |
||||||
|
-- |
||||||
|
2.9.5 |
||||||
|
|
@ -0,0 +1,75 @@ |
|||||||
|
From 051dae5efb4fc7c1c47ccb72ff161241fb0815ee Mon Sep 17 00:00:00 2001 |
||||||
|
From: Brian Foster <bfoster@redhat.com> |
||||||
|
Date: Mon, 28 Jan 2019 16:05:16 -0600 |
||||||
|
Subject: [PATCH] xfs_repair: initialize non-leaf finobt blocks with correct magic |
||||||
|
|
||||||
|
The free inode btree construction code in xfs_repair has a bug where |
||||||
|
any non-leaf nodes outside of the leftmost block at the associated |
||||||
|
level in the tree are incorrectly initialized with the inobt magic |
||||||
|
value. Update the prop_ino_cursor() path responsible for growing the |
||||||
|
non-leaf portion of the inode btrees to use the btnum of the |
||||||
|
specific tree being generated rather than the hardcoded inode btree |
||||||
|
type. |
||||||
|
|
||||||
|
Signed-off-by: Brian Foster <bfoster@redhat.com> |
||||||
|
Reported-by: Lucas Stach <l.stach@pengutronix.de> |
||||||
|
Root-caused-by: Lucas Stach <l.stach@pengutronix.de> |
||||||
|
Reviewed-by: Eric Sandeen <sandeen@redhat.com> |
||||||
|
Reviewed-by: Dave Chinner <dchinner@redhat.com> |
||||||
|
Signed-off-by: Eric Sandeen <sandeen@sandeen.net> |
||||||
|
--- |
||||||
|
|
||||||
|
(backported for RHEL7) |
||||||
|
|
||||||
|
--- xfsprogs-4.5.0/repair/phase5.c 2016-02-28 17:39:26.000000000 -0600 |
||||||
|
+++ xfsprogs-4.5.0-mine/repair/phase5.c 2019-02-05 11:18:28.046228329 -0600 |
||||||
|
@@ -1003,7 +1003,7 @@ init_ino_cursor(xfs_mount_t *mp, xfs_agn |
||||||
|
|
||||||
|
static void |
||||||
|
prop_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs, |
||||||
|
- xfs_agino_t startino, int level) |
||||||
|
+ __uint32_t magic, xfs_agino_t startino, int level) |
||||||
|
{ |
||||||
|
struct xfs_btree_block *bt_hdr; |
||||||
|
xfs_inobt_key_t *bt_key; |
||||||
|
@@ -1025,7 +1025,7 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agn |
||||||
|
* first path up the left side of the tree |
||||||
|
* where the agbno's are already set up |
||||||
|
*/ |
||||||
|
- prop_ino_cursor(mp, agno, btree_curs, startino, level); |
||||||
|
+ prop_ino_cursor(mp, agno, btree_curs, magic, startino, level); |
||||||
|
} |
||||||
|
|
||||||
|
if (be16_to_cpu(bt_hdr->bb_numrecs) == |
||||||
|
@@ -1062,11 +1062,11 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agn |
||||||
|
bt_hdr = XFS_BUF_TO_BLOCK(lptr->buf_p); |
||||||
|
memset(bt_hdr, 0, mp->m_sb.sb_blocksize); |
||||||
|
if (xfs_sb_version_hascrc(&mp->m_sb)) |
||||||
|
- xfs_btree_init_block(mp, lptr->buf_p, XFS_IBT_CRC_MAGIC, |
||||||
|
+ xfs_btree_init_block(mp, lptr->buf_p, magic, |
||||||
|
level, 0, agno, |
||||||
|
XFS_BTREE_CRC_BLOCKS); |
||||||
|
else |
||||||
|
- xfs_btree_init_block(mp, lptr->buf_p, XFS_IBT_MAGIC, |
||||||
|
+ xfs_btree_init_block(mp, lptr->buf_p, magic, |
||||||
|
level, 0, agno, 0); |
||||||
|
|
||||||
|
bt_hdr->bb_u.s.bb_leftsib = cpu_to_be32(lptr->prev_agbno); |
||||||
|
@@ -1074,7 +1074,7 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agn |
||||||
|
/* |
||||||
|
* propagate extent record for first extent in new block up |
||||||
|
*/ |
||||||
|
- prop_ino_cursor(mp, agno, btree_curs, startino, level); |
||||||
|
+ prop_ino_cursor(mp, agno, btree_curs, magic, startino, level); |
||||||
|
} |
||||||
|
/* |
||||||
|
* add inode info to current block |
||||||
|
@@ -1236,7 +1236,7 @@ build_ino_tree(xfs_mount_t *mp, xfs_agnu |
||||||
|
lptr->modulo--; |
||||||
|
|
||||||
|
if (lptr->num_recs_pb > 0) |
||||||
|
- prop_ino_cursor(mp, agno, btree_curs, |
||||||
|
+ prop_ino_cursor(mp, agno, btree_curs, magic, |
||||||
|
ino_rec->ino_startnum, 0); |
||||||
|
|
||||||
|
bt_rec = (xfs_inobt_rec_t *) |
@ -0,0 +1,105 @@ |
|||||||
|
From 0e81250e5125dc664e1938288e47ff52b1cacbe4 Mon Sep 17 00:00:00 2001 |
||||||
|
From: "Darrick J. Wong" <darrick.wong@oracle.com> |
||||||
|
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 <darrick.wong@oracle.com> |
||||||
|
Reviewed-by: Eric Sandeen <sandeen@redhat.com> |
||||||
|
[sandeen: shrink the map declaration] |
||||||
|
Signed-off-by: Eric Sandeen <sandeen@sandeen.net> |
||||||
|
--- |
||||||
|
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; |
@ -0,0 +1,67 @@ |
|||||||
|
From 9e43c34535bb72edc4a3a30e14b7d22b54c468cb Mon Sep 17 00:00:00 2001 |
||||||
|
From: "Darrick J. Wong" <darrick.wong@oracle.com> |
||||||
|
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 <darrick.wong@oracle.com> |
||||||
|
Reviewed-by: Eric Sandeen <sandeen@redhat.com> |
||||||
|
Signed-off-by: Eric Sandeen <sandeen@sandeen.net> |
||||||
|
--- |
||||||
|
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( |
@ -0,0 +1,64 @@ |
|||||||
|
From 001df390de88731675adae166db5f189924b107f Mon Sep 17 00:00:00 2001 |
||||||
|
From: "Darrick J. Wong" <darrick.wong@oracle.com> |
||||||
|
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 <darrick.wong@oracle.com> |
||||||
|
Reviewed-by: Eric Sandeen <sandeen@redhat.com> |
||||||
|
Signed-off-by: Eric Sandeen <sandeen@sandeen.net> |
||||||
|
--- |
||||||
|
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; |
||||||
|
} |
@ -0,0 +1,89 @@ |
|||||||
|
From 7e8a6edb4d1ba0079152eb477abbbc1dfb1ebb7e Mon Sep 17 00:00:00 2001 |
||||||
|
From: Pavel Reichl <preichl@redhat.com> |
||||||
|
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 <preichl@redhat.com> |
||||||
|
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> |
||||||
|
Reviewed-by: Dave Chinner <dchinner@redhat.com> |
||||||
|
Signed-off-by: Eric Sandeen <sandeen@sandeen.net> |
||||||
|
--- |
||||||
|
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) |
@ -0,0 +1,53 @@ |
|||||||
|
From 2383d7c5cf20efcff75cb29ca3e02cfbe1bf2209 Mon Sep 17 00:00:00 2001 |
||||||
|
From: Eric Sandeen <sandeen@redhat.com> |
||||||
|
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 <sandeen@redhat.com> |
||||||
|
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> |
||||||
|
Signed-off-by: Eric Sandeen <sandeen@sandeen.net> |
||||||
|
--- |
||||||
|
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"); |
||||||
|
|
||||||
|
} |
@ -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 <lvaz@redhat.com> |
||||||
|
Fixes: 7f2d6b811755 ("xfs_repair: avoid segfault if reporting progre...") |
||||||
|
Signed-off-by: Eric Sandeen <sandeen@redhat.com> |
||||||
|
--- |
||||||
|
|
||||||
|
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")); |
||||||
|
|
@ -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" |
Loading…
Reference in new issue