", open_flags = "LPO64"\n",
PFID(mdt_object_fid(obj)), open_flags);
+ /* We cannot enqueue another lock for the same resource we
+ * already have a lock for, due to mechanics of waiting list
+ * iterating in ldlm, see LU-3601.
+ * As such we'll drop the open lock we just got above here,
+ * it's ok not to have this open lock as it's main purpose is to
+ * flush unused cached client open handles. */
+ if (lustre_handle_is_used(&lhc->mlh_reg_lh))
+ mdt_object_unlock(info, obj, lhc, 1);
+
LASSERT(!try_layout);
mdt_lock_handle_init(ll);
mdt_lock_reg_init(ll, LCK_EX);
rc = 1;
}
- if (rc != 0) {
+ if (rc != 0 || !lustre_handle_is_used(&lhc->mlh_reg_lh)) {
struct ldlm_reply *ldlm_rep;
ldlm_rep = req_capsule_server_get(info->mti_pill, &RMF_DLM_REP);
mdt_clear_disposition(info, ldlm_rep, DISP_OPEN_LOCK);
- mdt_object_unlock(info, obj, lhc, 1);
+ if (lustre_handle_is_used(&lhc->mlh_reg_lh))
+ mdt_object_unlock(info, obj, lhc, 1);
}
RETURN_EXIT;
}