Commit 62e49413 authored by Hongchao Zhang's avatar Hongchao Zhang Committed by Greg Kroah-Hartman

staging/lustre/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".
Signed-off-by: default avatarHongchao Zhang <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/10849
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5128Reviewed-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2661e6c4
...@@ -1151,22 +1151,24 @@ void class_export_recovery_cleanup(struct obd_export *exp) ...@@ -1151,22 +1151,24 @@ void class_export_recovery_cleanup(struct obd_export *exp)
exp->exp_obd->obd_stale_clients++; exp->exp_obd->obd_stale_clients++;
} }
spin_unlock(&obd->obd_recovery_task_lock); spin_unlock(&obd->obd_recovery_task_lock);
spin_lock(&exp->exp_lock);
/** Cleanup req replay fields */ /** Cleanup req replay fields */
if (exp->exp_req_replay_needed) { if (exp->exp_req_replay_needed) {
spin_lock(&exp->exp_lock);
exp->exp_req_replay_needed = 0; exp->exp_req_replay_needed = 0;
spin_unlock(&exp->exp_lock);
LASSERT(atomic_read(&obd->obd_req_replay_clients)); LASSERT(atomic_read(&obd->obd_req_replay_clients));
atomic_dec(&obd->obd_req_replay_clients); atomic_dec(&obd->obd_req_replay_clients);
} }
/** Cleanup lock replay data */ /** Cleanup lock replay data */
if (exp->exp_lock_replay_needed) { if (exp->exp_lock_replay_needed) {
spin_lock(&exp->exp_lock);
exp->exp_lock_replay_needed = 0; exp->exp_lock_replay_needed = 0;
spin_unlock(&exp->exp_lock);
LASSERT(atomic_read(&obd->obd_lock_replay_clients)); LASSERT(atomic_read(&obd->obd_lock_replay_clients));
atomic_dec(&obd->obd_lock_replay_clients); atomic_dec(&obd->obd_lock_replay_clients);
} }
spin_unlock(&exp->exp_lock);
} }
/* This function removes 1-3 references from the export: /* This function removes 1-3 references from the export:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment