From patchwork Mon Nov 16 00:59:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11907025 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38B7C14B3 for ; Mon, 16 Nov 2020 01:01:30 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1925720578 for ; Mon, 16 Nov 2020 01:01:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1925720578 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 46E2521FA08; Sun, 15 Nov 2020 17:01:08 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 5DC5C306CFB for ; Sun, 15 Nov 2020 17:00:13 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 760872250; Sun, 15 Nov 2020 20:00:06 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 74199B5; Sun, 15 Nov 2020 20:00:06 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Sun, 15 Nov 2020 19:59:52 -0500 Message-Id: <1605488401-981-20-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1605488401-981-1-git-send-email-jsimmons@infradead.org> References: <1605488401-981-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 19/28] lustre: ldlm: BL AST vs failed lock enqueue race X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andriy Skulysh , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Andriy Skulysh failed_lock_cleanup() marks the lock with LDLM_FL_LOCAL_ONLY, so cancel request isn't sent. Mark failed lock with LDLM_FL_LOCAL_ONLY only if BL AST wasn't received. Add server's lock handle to BL AST RPC. So client will be able to cancel the lock even if enqueue fails. HPE-bug-id: LUS-8493, LUS-8830 WC-bug-id: https://jira.whamcloud.com/browse/LU-13989 Lustre-commit: c1be044913dde3 ("LU-13989 ldlm: BL AST vs failed lock enqueue race") Signed-off-by: Andriy Skulysh Reviewed-on: https://review.whamcloud.com/40046 Reviewed-by: Vladimir Saveliev Reviewed-by: Alexander Boyko Reviewed-by: Vitaly Fertman Reviewed-by: Alexander Boyko Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/ldlm/ldlm_lockd.c | 2 ++ fs/lustre/ldlm/ldlm_request.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/lustre/ldlm/ldlm_lockd.c b/fs/lustre/ldlm/ldlm_lockd.c index 1ae65b829..6f498cc 100644 --- a/fs/lustre/ldlm/ldlm_lockd.c +++ b/fs/lustre/ldlm/ldlm_lockd.c @@ -698,6 +698,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) ldlm_lock_remove_from_lru(lock); ldlm_set_bl_ast(lock); } + if (lock->l_remote_handle.cookie == 0) + lock->l_remote_handle = dlm_req->lock_handle[1]; unlock_res_and_lock(lock); /* diff --git a/fs/lustre/ldlm/ldlm_request.c b/fs/lustre/ldlm/ldlm_request.c index dd897ec..74bcba2 100644 --- a/fs/lustre/ldlm/ldlm_request.c +++ b/fs/lustre/ldlm/ldlm_request.c @@ -317,8 +317,11 @@ static void failed_lock_cleanup(struct ldlm_namespace *ns, * bl_ast and -EINVAL reply is sent to server anyways. * b=17645 */ - lock->l_flags |= LDLM_FL_LOCAL_ONLY | LDLM_FL_FAILED | + lock->l_flags |= LDLM_FL_FAILED | LDLM_FL_ATOMIC_CB | LDLM_FL_CBPENDING; + if (!(ldlm_is_bl_ast(lock) && + lock->l_remote_handle.cookie != 0)) + lock->l_flags |= LDLM_FL_LOCAL_ONLY; need_cancel = 1; } unlock_res_and_lock(lock);