From: Fan Yong Date: Sun, 22 Nov 2015 05:38:11 +0000 (+0800) Subject: LU-7302 scrub: join the running OI scrub properly X-Git-Tag: 2.8.55~46 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=93205e724bd7a07ef56636d1042a430777b89405 LU-7302 scrub: join the running OI scrub properly Sometimes, the OI scrub can be triggered as partial mode by randomly found inconsistent OI mapping(s). Under such case, if the sysadmin triggers LFSCK/OI scrub (full mode) manually, the partial mode OI scrub needs to be converted as full mode via osd_scrub_join(). Before that, it will check whether the current OI scrub is full mode or not. Originally, we checked the SF_AUTO flags (scrub::os_file.sf_flags) only, but ignored the partial mode (scrub::os_partial_scan). The partial mode OI scrub will NOT change the scrub iteration cursor (srub:: os_pos_current). So if miss to convert the partial OI scrub, the subsequent inode table based iteration will be blocked inside osd_otable_it_next() as following: if (it->ooi_cache.ooc_pos_preload >= scrub->os_pos_current) l_wait_event(thread->t_ctl_waitq, osd_otable_it_wakeup(scrub, it), &lwi); This patch fix such issue by checking the conditions properly. Signed-off-by: Fan Yong Change-Id: I41cf519e717f356f21a1eebebefda1e44a3bd5ae Reviewed-on: http://review.whamcloud.com/18175 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index 8c0c5ec..0027138 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -2394,7 +2394,8 @@ static int do_osd_scrub_start(struct osd_device *dev, __u32 flags) again: if (thread_is_running(thread)) { spin_unlock(&scrub->os_lock); - if (!(scrub->os_file.sf_flags & SF_AUTO) || + if (!(scrub->os_file.sf_flags & SF_AUTO || + scrub->os_partial_scan) || (flags & (SS_AUTO_FULL | SS_AUTO_PARTIAL))) RETURN(-EALREADY); @@ -2894,6 +2895,8 @@ static int osd_otable_it_load(const struct lu_env *env, if (it->ooi_user_ready) RETURN(-EPERM); + LASSERT(!scrub->os_partial_scan); + if (hash > OSD_OTABLE_MAX_HASH) hash = OSD_OTABLE_MAX_HASH;