From 7a18fe124c215ad7ab1806abd62bea9c7b9592c6 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Fri, 24 Jan 2020 15:12:54 +0300 Subject: [PATCH] LU-13170 osd: positive lookup shouldn't return an error 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 Reviewed-on: https://review.whamcloud.com/37322 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Nunez Reviewed-by: Hongchao Zhang --- lustre/osd-zfs/osd_index.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lustre/osd-zfs/osd_index.c b/lustre/osd-zfs/osd_index.c index d0caf36..765099a 100644 --- a/lustre/osd-zfs/osd_index.c +++ b/lustre/osd-zfs/osd_index.c @@ -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)) { - 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))); - /* Only -ENOENT error will affect the lookup result. */ - if (rc != -ENOENT) - rc = 0; } return rc == 0 ? 1 : (rc == -ENOENT ? -ENODATA : rc); -- 1.8.3.1