Fix 'data race condition' defects found by Coverity version
6.5.0:
Data race condition (MISSING_LOCK)
Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: I29825c47f08a893685a62aeea2e49b315149b3d9
Reviewed-on: http://review.whamcloud.com/6573
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
scrub->os_full_speed = 1;
scrub->os_in_prior = 0;
+ spin_lock(&scrub->os_lock);
scrub->os_waiting = 0;
scrub->os_paused = 0;
+ spin_unlock(&scrub->os_lock);
scrub->os_new_checked = 0;
if (sf->sf_pos_last_checkpoint != 0)
sf->sf_pos_latest_start = sf->sf_pos_last_checkpoint + 1;
ooc->ooc_pos_preload, rc);
if (scrub->os_waiting && osd_scrub_has_window(scrub, ooc)) {
+ spin_lock(&scrub->os_lock);
scrub->os_waiting = 0;
cfs_waitq_broadcast(&scrub->os_thread.t_ctl_waitq);
+ spin_unlock(&scrub->os_lock);
}
RETURN(rc < 0 ? rc : ooc->ooc_cached_items);