Whamcloud - gitweb
LU-7302 scrub: join the running OI scrub properly 75/18175/2
authorFan Yong <fan.yong@intel.com>
Sun, 22 Nov 2015 05:38:11 +0000 (13:38 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 14 Jun 2016 03:50:48 +0000 (03:50 +0000)
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 <fan.yong@intel.com>
Change-Id: I41cf519e717f356f21a1eebebefda1e44a3bd5ae
Reviewed-on: http://review.whamcloud.com/18175
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_scrub.c

index 8c0c5ec..0027138 100644 (file)
@@ -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;