Whamcloud - gitweb
LU-13170 osd: positive lookup shouldn't return an error 22/37322/8
authorAlex Zhuravlev <bzzz@whamcloud.com>
Fri, 24 Jan 2020 12:12:54 +0000 (15:12 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 9 Dec 2020 07:47:56 +0000 (07:47 +0000)
because of stale OI, otherwise LFSCK has no chance to
fix direntry. lookup should initiate OI scrubber and
give it a hint about FID->dnode mapping.

This should fix sanity-lfsck/23b failing with ZFS often.

Test-Parameters: fstype=zfs testlist=sanity-lfsck env=ONLY=23b,ONLY_REPEAT=200
Change-Id: Iea826de9995e34939eff2d67a831deb6b192bd4d
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/37322
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
lustre/osd-zfs/osd_index.c

index d0caf36..765099a 100644 (file)
@@ -682,11 +682,17 @@ static int osd_dir_lookup(const struct lu_env *env, struct dt_object *dt,
 
 out:
        if (!rc && !osd_remote_fid(env, osd, fid)) {
 
 out:
        if (!rc && !osd_remote_fid(env, osd, fid)) {
-               rc = osd_consistency_check(env, osd, obj, fid, oid,
+               /*
+                * this should ask the scrubber to check OI given
+                * the mapping we just found in the dir entry.
+                * but result of that check should not affect
+                * result of the lookup in the directory.
+                * otherwise such a direntry becomes hidden
+                * from the layers above, including LFSCK which
+                * is supposed to fix dangling entries.
+                */
+               osd_consistency_check(env, osd, obj, fid, oid,
                                S_ISDIR(DTTOIF(oti->oti_zde.lzd_reg.zde_type)));
                                S_ISDIR(DTTOIF(oti->oti_zde.lzd_reg.zde_type)));
-               /* Only -ENOENT error will affect the lookup result. */
-               if (rc != -ENOENT)
-                       rc = 0;
        }
 
        return rc == 0 ? 1 : (rc == -ENOENT ? -ENODATA : rc);
        }
 
        return rc == 0 ? 1 : (rc == -ENOENT ? -ENODATA : rc);