From: Sebastien Buisson Date: Thu, 6 Jun 2013 12:40:06 +0000 (+0200) Subject: LU-2744 build: fix 'data race condition' issues X-Git-Tag: 2.4.93~70 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=56f17af39b51eae99486ba12d8925cbe785c4e29;p=fs%2Flustre-release.git LU-2744 build: fix 'data race condition' issues 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 Change-Id: I29825c47f08a893685a62aeea2e49b315149b3d9 Reviewed-on: http://review.whamcloud.com/6573 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger --- diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index 5e6ee4a..a74ca9b 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -395,8 +395,10 @@ static int osd_scrub_prep(struct osd_device *dev) 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; @@ -1214,8 +1216,10 @@ static int osd_otable_it_preload(const struct lu_env *env, 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);