Whamcloud - gitweb
LU-11301 target: add lock in sub_trans_stop_cb() 69/33169/2
authorLai Siyao <lai.siyao@intel.com>
Mon, 27 Aug 2018 20:55:56 +0000 (04:55 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 21 Sep 2018 03:31:04 +0000 (03:31 +0000)
sub_trans st_committed and st_stopped flags take different bit of
the same memory address, so both of them should be set with lock,
but sub_trans_stop_cb() doesn't, which may cause it overriden.

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: Ic3d7d7281b3cf9bd20702be944e14f35200318f1
Reviewed-on: https://review.whamcloud.com/33169
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/target/update_trans.c

index f9dc367..154da72 100644 (file)
@@ -526,6 +526,7 @@ static void sub_trans_stop_cb(struct lu_env *env,
        struct top_multiple_thandle     *tmt = cb->dcb_data;
        ENTRY;
 
+       spin_lock(&tmt->tmt_sub_lock);
        list_for_each_entry(st, &tmt->tmt_sub_thandle_list, st_sub_list) {
                if (st->st_stopped)
                        continue;
@@ -536,6 +537,7 @@ static void sub_trans_stop_cb(struct lu_env *env,
                        break;
                }
        }
+       spin_unlock(&tmt->tmt_sub_lock);
 
        wake_up(&tmt->tmt_stop_waitq);
        RETURN_EXIT;