From 1b0bfeb5e5ef99f2e5e325ef931514c3e86aeb4d Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Wed, 5 Aug 2020 14:02:35 -0400 Subject: [PATCH] repair: don't double check dir2 sf parent in phase 4 The shortform parent ino verification code runs once in phase 3 (ino_discovery == true) and once in phase 4 (ino_discovery == false). This is unnecessary and leads to duplicate error messages if repair replaces an invalid parent value with zero because zero is still an invalid value. Skip the check in phase 4. Signed-off-by: Brian Foster Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong [sandeen: add comments suggested by Darrick during review] Signed-off-by: Eric Sandeen --- repair/dir2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/repair/dir2.c b/repair/dir2.c index b374bc7b1..57c5ee465 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -480,6 +480,15 @@ _("corrected entry offsets in directory %" PRIu64 "\n"), * check parent (..) entry */ *parent = libxfs_dir2_sf_get_parent_ino(sfp); + /* + * If this function is called during inode discovery (phase 3), it will + * set a bad sf dir parent pointer to the root directory. This fixes + * the directory enough to pass the inode fork verifier in phase 6 when + * we try to reset the parent pointer to the correct value. There is no + * need to re-check the parent pointer during phase 4. + */ + if (!ino_discovery) + return 0; /* * if parent entry is bogus, null it out. we'll fix it later . -- 2.47.2