summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/dir_repair.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/scrub/dir_repair.c')
-rw-r--r--fs/xfs/scrub/dir_repair.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/xfs/scrub/dir_repair.c b/fs/xfs/scrub/dir_repair.c
index e7d52c77456b..825f291b9402 100644
--- a/fs/xfs/scrub/dir_repair.c
+++ b/fs/xfs/scrub/dir_repair.c
@@ -1040,6 +1040,29 @@ xrep_dir_lookup_parent(
return parent_ino;
}
+/*
+ * Look up '..' in the dentry cache and confirm that it's really the parent.
+ * Returns NULLFSINO if the dcache misses or if the hit is implausible.
+ */
+static inline xfs_ino_t
+xrep_dir_dcache_parent(
+ struct xrep_dir *rd)
+{
+ struct xfs_scrub *sc = rd->sc;
+ xfs_ino_t parent_ino;
+ int error;
+
+ parent_ino = xrep_parent_from_dcache(sc);
+ if (parent_ino == NULLFSINO)
+ return parent_ino;
+
+ error = xrep_parent_confirm(sc, &parent_ino);
+ if (error)
+ return NULLFSINO;
+
+ return parent_ino;
+}
+
/* Try to find the parent of the directory being repaired. */
STATIC int
xrep_dir_find_parent(
@@ -1051,6 +1074,10 @@ xrep_dir_find_parent(
if (rd->parent_ino != NULLFSINO)
return 0;
+ rd->parent_ino = xrep_dir_dcache_parent(rd);
+ if (rd->parent_ino != NULLFSINO)
+ return 0;
+
rd->parent_ino = xrep_dir_lookup_parent(rd);
if (rd->parent_ino != NULLFSINO)
return 0;