xfs stable candidate patches for 5.4.y
cover xfs stable candidate patches for 5.4.y
Hi Darrick,
Two of the commits backported from v5.5
(https://lore.kernel.org/linux-xfs/[email protected]/T/#t)
introduced regressions of their own. Hence this patchset includes two backported commits to fix those regressions.
The first patch i.e. "xfs: fix an ABBA deadlock in xfs_rename" fixes a regression that was introduced by "xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename()".
The second patch i.e. "xfs: fix use-after-free when aborting corrupt attr inactivation" fixes a regression that was introduced by "xfs: fix use-after-free when aborting corrupt attr inactivation".
This patchset has been tested by executing fstests (via kdevops) using the following XFS configurations,
1. No CRC (with 512 and 4k block size).
2. Reflink/Rmapbt (1k and 4k block size).
3. Reflink without Rmapbt.
4. External log device.
Darrick J. Wong (2):
xfs: fix an ABBA deadlock in xfs_rename
xfs: fix use-after-free when aborting corrupt attr inactivation
fs/xfs/libxfs/xfs_dir2.h | 2 -- fs/xfs/libxfs/xfs_dir2_sf.c | 2 +- fs/xfs/xfs_attr_inactive.c | 2 +- fs/xfs/xfs_inode.c | 42 ++++++++++++++++++++++--------------- 4 files changed, 27 insertions(+), 21 deletions(-)
Signature · 1 line
2.35.1
PATCH 1/2 xfs: fix an ABBA deadlock in xfs_rename
From: "Darrick J. Wong" <[email protected]>
commit 6da1b4b1ab36d80a3994fd4811c8381de10af604 upstream.
When overlayfs is running on top of xfs and the user unlinks a file in the overlay, overlayfs will create a whiteout inode and ask xfs to "rename" the whiteout file atop the one being unlinked. If the file being unlinked loses its one nlink, we then have to put the inode on the unlinked list.
This requires us to grab the AGI buffer of the whiteout inode to take it off the unlinked list (which is where whiteouts are created) and to grab the AGI buffer of the file being deleted. If the whiteout was created in a higher numbered AG than the file being deleted, we'll lock the AGIs in the wrong order and deadlock.
Therefore, grab all the AGI locks we think we'll need ahead of time, and in order of increasing AG number per the locking rules.
--- fs/xfs/libxfs/xfs_dir2.h | 2 -- fs/xfs/libxfs/xfs_dir2_sf.c | 2 +- fs/xfs/xfs_inode.c | 42 ++++++++++++++++++++++--------------- 3 files changed, 26 insertions(+), 20 deletions(-)
fs/xfs/libxfs/xfs_dir2.h +0 -2
@@ -124,8 +124,6 @@ extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp,extern int xfs_dir_removename (struct xfs_trans *tp,struct xfs_inode *dp,struct xfs_name *name,xfs_ino_t ino,xfs_extlen_t tot); -extern bool xfs_dir2_sf_replace_needblock (struct xfs_inode *dp, -xfs_ino_t inum);extern int xfs_dir_replace (struct xfs_trans *tp,struct xfs_inode *dp,struct xfs_name *name,xfs_ino_t inum,xfs_extlen_t tot);
fs/xfs/libxfs/xfs_dir2_sf.c +1 -1
@@ -947,7 +947,7 @@ xfs_dir2_sf_removename(/* * Check whether the sf dir replace operation need more blocks. */ -bool +static bool xfs_dir2_sf_replace_needblock (struct xfs_inode *dp,xfs_ino_t inum)
fs/xfs/xfs_inode.c +25 -17
60 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 2/2 xfs: fix use-after-free when aborting corrupt attr inactivation
In reply to Chandan Babu RFrom: "Darrick J. Wong" <[email protected]>
commit 496b9bcd62b0b3a160be61e3265a086f97adcbd3 upstream.
Log the corrupt buffer before we release the buffer.
--- fs/xfs/xfs_attr_inactive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_attr_inactive.c +1 -1
@@ -209,8 +209,8 @@ xfs_attr3_node_inactive(* Since this code is recursive (gasp!) we must protect ourselves. */ if (level >XFS_DA_NODE_MAXDEPTH ) { -xfs_trans_brelse (*trans, bp);/* no locks for later trans */ xfs_buf_corruption_error (bp); +xfs_trans_brelse (*trans, bp);/* no locks for later trans */ return -EFSCORRUPTED ; }
Signature · 1 line
2.35.1
Quoted 7 lines · Chandan Babu R
Hi Darrick,
Two of the commits backported from v5.5
(https://lore.kernel.org/linux-xfs/[email protected]/T/#t)
introduced regressions of their own. Hence this patchset includes two backported commits to fix those regressions.
Quoted 7 lines
The first patch i.e. "xfs: fix an ABBA deadlock in
xfs_rename" fixes a regression that was introduced by "xfs: Fix deadlock between AGI and AGF whentarget_ipexists inxfs_rename()".The second patch i.e. "xfs: fix use-after-free when aborting corrupt attr inactivation" fixes a regression that was introduced by "xfs: fix use-after-free when aborting corrupt attr inactivation".
Looks good to me, thanks for fishing out these two extra fixes.
--D
Quoted 21 lines
This patchset has been tested by executing fstests (via kdevops) using the following XFS configurations,
1. No CRC (with 512 and 4k block size).
2. Reflink/Rmapbt (1k and 4k block size).
3. Reflink without Rmapbt.
4. External log device.Darrick J. Wong (2):
xfs: fix an ABBA deadlock inxfs_rename
xfs: fix use-after-free when aborting corrupt attr inactivationfs/xfs/libxfs/xfs_dir2.h | 2 -- fs/xfs/libxfs/xfs_dir2_sf.c | 2 +- fs/xfs/xfs_attr_inactive.c | 2 +- fs/xfs/xfs_inode.c | 42 ++++++++++++++++++++++--------------- 4 files changed, 27 insertions(+), 21 deletions(-)Signature · 1 line
2.35.1
Quoted 12 lines · Darrick J. Wong
Quoted 11 lines · Chandan Babu R
Hi Darrick,
Two of the commits backported from v5.5
(https://lore.kernel.org/linux-xfs/[email protected]/T/#t)
introduced regressions of their own. Hence this patchset includes two backported commits to fix those regressions.The first patch i.e. "xfs: fix an ABBA deadlock in
xfs_rename" fixes a regression that was introduced by "xfs: Fix deadlock between AGI and AGF whentarget_ipexists inxfs_rename()".
Quoted 7 lines
Quoted 3 lines
The second patch i.e. "xfs: fix use-after-free when aborting corrupt attr inactivation" fixes a regression that was introduced by "xfs: fix use-after-free when aborting corrupt attr inactivation".
Looks good to me, thanks for fishing out these two extra fixes.
Acked-by Darrick J. Wong <[email protected]>
Thanks for ack-ing the patchset. Btw, these two fixes were identified by Greg.
Signature · 1 line
chandan