Whamcloud - gitweb
LU-16380 osd-ldiskfs: race in OI mapping 14/49514/2
authorLai Siyao <lai.siyao@whamcloud.com>
Sat, 17 Dec 2022 13:06:16 +0000 (08:06 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 19 Jan 2023 15:31:59 +0000 (15:31 +0000)
There is race in OI scrub thread and OI mapping entry insertion, which
may add an inconsistent OI mapping entry, but not started OI scrub
thread. This may lead to osd_fid_lookup() always returns -EINPROGRESS.

To avoid such race, osd_fid_lookup() returns -EINPROGRESS only when
OI mapping is inconsistent, and OI scrub thread is not running.

Fixes: 558784caad ("LU-15643 osd-ldiskfs: don't trigger scrub on irreparable FIDs")
Test-Parameters: mdscount=2 mdtcount=4 testlist=conf-sanity env=ONLY=108b,ONLY_REPEAT=50
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I05114b6a33940c210e9952f6e24f6c36fd7f76a2
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49514
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_handler.c

index 18c747d..bb57382 100644 (file)
@@ -1155,7 +1155,8 @@ static int osd_fid_lookup(const struct lu_env *env, struct osd_object *obj,
        /* Search order: 2. OI scrub pending list. */
        id = &info->oti_id;
        memset(id, 0, sizeof(struct osd_inode_id));
-       if (fid_in_scrub_list(scrub, &scrub->os_inconsistent_items, fid))
+       if (fid_in_scrub_list(scrub, &scrub->os_inconsistent_items, fid) &&
+           scrub->os_running)
                RETURN(-EINPROGRESS);
 
        stale = fid_in_scrub_list(scrub, &scrub->os_stale_items, fid);