Upon lock enqueue re-send, lock is pinned by ldlm_handle_enqueue0,
however it may race with client eviction or even lock cancel (if
a reply for the original RPC finally reached the client) and the
lock cannot be found by cookie anymore:
ASSERTION( lock != NULL ) failed: Invalid lock handle
Signed-off-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Change-Id: I9d8156bf78a1b83ac22ffaa1148feb43bef37b1a
Xyratex-bug-id: MRP-2094
Reviewed-on: http://review.whamcloud.com/11839
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
rc = mdt_check_resent_lock(info, child, lhc);
if (rc < 0) {
rc = mdt_check_resent_lock(info, child, lhc);
if (rc < 0) {
} else if (rc > 0) {
mdt_lock_handle_init(lhc);
mdt_lock_reg_init(lhc, LCK_PR);
} else if (rc > 0) {
mdt_lock_handle_init(lhc);
mdt_lock_reg_init(lhc, LCK_PR);
lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
LASSERT(lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT);
lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
LASSERT(lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT);
- LASSERTF(lock != NULL, "Invalid lock handle "LPX64"\n",
- lhc->mlh_reg_lh.cookie);
+ if (lock == NULL) {
+ /* Lock is pinned by ldlm_handle_enqueue0() as it is
+ * a resend case, however, it could be already destroyed
+ * due to client eviction or a raced cancel RPC. */
+ LDLM_DEBUG_NOLOCK("Invalid lock handle "LPX64"\n",
+ lhc->mlh_reg_lh.cookie);
+ RETURN(-ESTALE);
+ }
if (!fid_res_name_eq(mdt_object_fid(mo),
&lock->l_resource->lr_name)) {
if (!fid_res_name_eq(mdt_object_fid(mo),
&lock->l_resource->lr_name)) {