From: Lai Siyao Date: Sat, 4 Jan 2020 20:51:32 +0000 (+0800) Subject: LU-11025 mdt: don't save remote lock if op not from client X-Git-Tag: 2.13.54~141 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F81%2F37281%2F8;p=fs%2Flustre-release.git LU-11025 mdt: don't save remote lock if op not from client Some operation may not be originated from client, e.g., directory auto split, in this case ptlrpc_request is NULL, therefore we can't get the transaction number from request and save remote lock. This means upon remote lock cancel this distributed transaction may not be committed yet, that is to say, commit-on-sharing won't be triggered if subsequent operations depend on this operation. However this won't cause any inconsistency normally, because upon one MDT failure, this distributed transaction can be replayed from update logs in other MDT, and as a side effect, it avoids continuous commit in directory auto split. Signed-off-by: Lai Siyao Change-Id: If7608cab96f36480654d5d7a0f5a0f1c4dfd12b2 Reviewed-on: https://review.whamcloud.com/37281 Reviewed-by: Andreas Dilger Reviewed-by: Hongchao Zhang Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 4deb40e..e5ed97a 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -3525,20 +3525,18 @@ static void mdt_save_remote_lock(struct mdt_thread_info *info, if (lustre_handle_is_used(h)) { struct ldlm_lock *lock = ldlm_handle2lock(h); + struct ptlrpc_request *req = mdt_info_req(info); if (o != NULL && (lock->l_policy_data.l_inodebits.bits & (MDS_INODELOCK_XATTR | MDS_INODELOCK_UPDATE))) mo_invalidate(info->mti_env, mdt_object_child(o)); - if (decref || !info->mti_has_trans || + if (decref || !info->mti_has_trans || !req || !(mode & (LCK_PW | LCK_EX))) { ldlm_lock_decref_and_cancel(h, mode); LDLM_LOCK_PUT(lock); } else { - struct ptlrpc_request *req = mdt_info_req(info); - - LASSERT(req != NULL); tgt_save_slc_lock(&info->mti_mdt->mdt_lut, lock, req->rq_transno); ldlm_lock_decref(h, mode);