@@ -2253,7 +2253,8 @@ int __ldlm_replay_locks(struct obd_import *imp, bool rate_limit)
struct ldlm_lock *lock;
int rc = 0;
- LASSERT(atomic_read(&imp->imp_replay_inflight) == 1);
+ while (atomic_read(&imp->imp_replay_inflight) != 1)
+ cond_resched();
/* don't replay locks if import failed recovery */
if (imp->imp_vbr_failed)
@@ -2311,9 +2312,12 @@ int ldlm_replay_locks(struct obd_import *imp)
struct task_struct *task;
int rc = 0;
- class_import_get(imp);
/* ensure this doesn't fall to 0 before all have been queued */
- atomic_inc(&imp->imp_replay_inflight);
+ if (atomic_inc_return(&imp->imp_replay_inflight) > 1) {
+ atomic_dec(&imp->imp_replay_inflight);
+ return 0;
+ }
+ class_import_get(imp);
task = kthread_run(ldlm_lock_replay_thread, imp, "ldlm_lock_replay");
if (IS_ERR(task)) {
@@ -519,8 +519,8 @@ struct obd_device *class_incref(struct obd_device *obd,
{
lu_ref_add_atomic(&obd->obd_reference, scope, source);
atomic_inc(&obd->obd_refcount);
- CDEBUG(D_INFO, "incref %s (%p) now %d\n", obd->obd_name, obd,
- atomic_read(&obd->obd_refcount));
+ CDEBUG(D_INFO, "incref %s (%p) now %d - %s\n", obd->obd_name, obd,
+ atomic_read(&obd->obd_refcount), scope);
return obd;
}