summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/scrub/common.c')
-rw-r--r--fs/xfs/scrub/common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index 90733367a2bf..021afada3aa1 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -759,7 +759,13 @@ xchk_get_inode(
error, __return_address);
return error;
}
- if (VFS_I(ip)->i_generation != sc->sm->sm_gen) {
+
+ /*
+ * Scrubbing by handle requires the exact ino/gen pair, and is not
+ * allowed for non-directory metadata files.
+ */
+ if (VFS_I(ip)->i_generation != sc->sm->sm_gen ||
+ (xfs_is_metadata_inode(ip) && !S_ISDIR(VFS_I(ip)->i_mode))) {
xfs_irele(ip);
return -ENOENT;
}