diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-01-05 17:43:54 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-03-25 17:08:25 -0700 |
commit | b964d0a2cca5b843050a6c49546fec0ebdb8a00f (patch) | |
tree | 65c03b1177db6dfd07afad969eb199edbf387a41 | |
parent | 418f79edd2b4c4835b6c9b47d95cf439e284e374 (diff) |
xfs: allow rmap repair to grab unlinked inodes
Permit rmapbt repair to grab unlinked inodes so that we can avoid
erroring out on those inodes.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r-- | fs/xfs/scrub/rmap_repair.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_icache.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_icache.h | 5 |
3 files changed, 10 insertions, 1 deletions
diff --git a/fs/xfs/scrub/rmap_repair.c b/fs/xfs/scrub/rmap_repair.c index 16b4a2f7ed7c..806f49431a4f 100644 --- a/fs/xfs/scrub/rmap_repair.c +++ b/fs/xfs/scrub/rmap_repair.c @@ -582,7 +582,8 @@ xrep_rmap_scan_inode( int error; /* Grab inode and lock it so we can scan it. */ - error = xfs_iget(mp, rr->sc->tp, ino, XFS_IGET_DONTCACHE, 0, &ip); + error = xfs_iget(mp, rr->sc->tp, ino, + XFS_IGET_DONTCACHE | XFS_IGET_UNLINKED, 0, &ip); if (error) return error; diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 5fd13ba2482c..d9aa24641de7 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -438,6 +438,9 @@ xfs_iget_check_free_state( struct xfs_inode *ip, int flags) { + if (flags & XFS_IGET_UNLINKED) + return 0; + /* * Unlinked inodes awaiting inactivation must not be reused until we * have a chance to clear the on-disk metadata. diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h index 1f94ef72fffb..160e895c877c 100644 --- a/fs/xfs/xfs_icache.h +++ b/fs/xfs/xfs_icache.h @@ -34,6 +34,11 @@ struct xfs_eofblocks { #define XFS_IGET_UNTRUSTED 0x2 #define XFS_IGET_DONTCACHE 0x4 #define XFS_IGET_INCORE 0x8 /* don't read from disk or reinit */ +/* + * Return unlinked inodes. Callers must disable inactivation prior to using + * this. This is one of those weird repair things; don't use it. + */ +#define XFS_IGET_UNLINKED 0x10 int xfs_iget(struct xfs_mount *mp, struct xfs_trans *tp, xfs_ino_t ino, uint flags, uint lock_flags, xfs_inode_t **ipp); |