diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-04-22 09:48:10 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-04-23 16:55:13 -0700 |
commit | 8559b21a64d983315bdf1bd9f8dfdf732c56d057 (patch) | |
tree | dccc9108a60880a9b140e65848e7f2b1421ca56c /fs/xfs/scrub/findparent.c | |
parent | 76fc23b695f4717bb5e7b616eaad7d6213fdea9f (diff) | |
download | linux-stable-8559b21a64d983315bdf1bd9f8dfdf732c56d057.tar.gz linux-stable-8559b21a64d983315bdf1bd9f8dfdf732c56d057.tar.bz2 linux-stable-8559b21a64d983315bdf1bd9f8dfdf732c56d057.zip |
xfs: implement live updates for directory repairs
While we're scanning the filesystem for parent pointers that we can turn
into dirents, we cannot hold the IOLOCK or ILOCK of the directory being
repaired. Therefore, we need to set up a dirent hook so that we can
keep the temporary directory up to date with the rest of the filesystem.
Hence we add the ability to *remove* entries from the temporary dir.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/scrub/findparent.c')
-rw-r--r-- | fs/xfs/scrub/findparent.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/xfs/scrub/findparent.c b/fs/xfs/scrub/findparent.c index 712dd73e4789..c78422ad757b 100644 --- a/fs/xfs/scrub/findparent.c +++ b/fs/xfs/scrub/findparent.c @@ -238,9 +238,10 @@ xrep_findparent_live_update( * will be called when there is a dotdot update for the inode being repaired. */ int -xrep_findparent_scan_start( +__xrep_findparent_scan_start( struct xfs_scrub *sc, - struct xrep_parent_scan_info *pscan) + struct xrep_parent_scan_info *pscan, + notifier_fn_t custom_fn) { int error; @@ -262,7 +263,10 @@ xrep_findparent_scan_start( * ILOCK, which means that any in-progress inode updates will finish * before we can scan the inode. */ - xfs_dir_hook_setup(&pscan->dhook, xrep_findparent_live_update); + if (custom_fn) + xfs_dir_hook_setup(&pscan->dhook, custom_fn); + else + xfs_dir_hook_setup(&pscan->dhook, xrep_findparent_live_update); error = xfs_dir_hook_add(sc->mp, &pscan->dhook); if (error) goto out_iscan; |