From: Wu Libin Date: Thu, 14 Aug 2014 21:27:21 +0000 (-0700) Subject: LU-5128 obdclass: fix a race in recovery X-Git-Tag: 2.5.3~15 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7e8275b1669d5df047790f6ca2e03ba203634b11;p=fs%2Flustre-release.git LU-5128 obdclass: fix a race in recovery in "class_export_recovery_cleanup", the check of the flag "exp->exp_req_replay_needed" should be protected by "exp_lock". Lustre-commit: 5a7e4480fc519c8df4ca0b11e6d5239956316bd3 Lustre-change: http://review.whamcloud.com/10849 Signed-off-by: Hongchao Zhang Signed-off-by: Wu Libin Signed-off-by: Jian Yu Change-Id: Ib3c980101f400ce1b9cb0b3d2a4418fbec31b94b Reviewed-on: http://review.whamcloud.com/11102 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 1479a39..72aaa31 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -1171,21 +1171,20 @@ void class_export_recovery_cleanup(struct obd_export *exp) } spin_unlock(&obd->obd_recovery_task_lock); /** Cleanup req replay fields */ + + spin_lock(&exp->exp_lock); if (exp->exp_req_replay_needed) { - spin_lock(&exp->exp_lock); exp->exp_req_replay_needed = 0; - spin_unlock(&exp->exp_lock); LASSERT(cfs_atomic_read(&obd->obd_req_replay_clients)); cfs_atomic_dec(&obd->obd_req_replay_clients); } /** Cleanup lock replay data */ if (exp->exp_lock_replay_needed) { - spin_lock(&exp->exp_lock); exp->exp_lock_replay_needed = 0; - spin_unlock(&exp->exp_lock); LASSERT(cfs_atomic_read(&obd->obd_lock_replay_clients)); cfs_atomic_dec(&obd->obd_lock_replay_clients); } + spin_unlock(&exp->exp_lock); } /* This function removes 1-3 references from the export: