From patchwork Thu Feb 27 21:13:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410653 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 DA19217E0 for ; Thu, 27 Feb 2020 21:43:29 +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 C320E24690 for ; Thu, 27 Feb 2020 21:43:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C320E24690 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 1313E349314; Thu, 27 Feb 2020 13:35:01 -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 184F921FB16 for ; Thu, 27 Feb 2020 13:20:12 -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 9B8D18AA5; Thu, 27 Feb 2020 16:18:17 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 9A19D47C; Thu, 27 Feb 2020 16:18:17 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:13:54 -0500 Message-Id: <1582838290-17243-367-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 366/622] lustre: ldlm: layout lock fixes 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: Vitaly Fertman , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Vitaly Fertman as the intent_layout operation becomes more frequent with SEL, cancel existent layout locks in advance and reuse ELC to deliver cancels to MDS as clients are given LCK_EX layout locks, take into account this mode as well in ldlm_lock_match Cray-bug-id: LUS-2528 WC-bug-id: https://jira.whamcloud.com/browse/LU-10070 Lustre-commit: 51f23ffa4dae ("LU-10070 ldlm: layout lock fixes") Signed-off-by: Vitaly Fertman Reviewed-on: https://review.whamcloud.com/35232 Reviewed-by: Patrick Farrell Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/file.c | 3 ++- fs/lustre/mdc/mdc_locks.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c index a27c06c..9321b84 100644 --- a/fs/lustre/llite/file.c +++ b/fs/lustre/llite/file.c @@ -4978,7 +4978,8 @@ int ll_layout_refresh(struct inode *inode, u32 *gen) * match it before grabbing layout lock mutex. */ mode = ll_take_md_lock(inode, MDS_INODELOCK_LAYOUT, &lockh, 0, - LCK_CR | LCK_CW | LCK_PR | LCK_PW); + LCK_CR | LCK_CW | LCK_PR | + LCK_PW | LCK_EX); if (mode != 0) { /* hit cached lock */ rc = ll_layout_lock_set(&lockh, mode, inode); if (rc == -EAGAIN) diff --git a/fs/lustre/mdc/mdc_locks.c b/fs/lustre/mdc/mdc_locks.c index cf6bc9d..5885bbd 100644 --- a/fs/lustre/mdc/mdc_locks.c +++ b/fs/lustre/mdc/mdc_locks.c @@ -580,18 +580,26 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp, struct md_op_data *op_data) { struct obd_device *obd = class_exp2obd(exp); + struct list_head cancels = LIST_HEAD_INIT(cancels); struct ptlrpc_request *req; struct ldlm_intent *lit; struct layout_intent *layout; - int rc; + int count = 0, rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_LDLM_INTENT_LAYOUT); if (!req) return ERR_PTR(-ENOMEM); + if (fid_is_sane(&op_data->op_fid2) && (it->it_op & IT_LAYOUT) && + (it->it_flags & FMODE_WRITE)) { + count = mdc_resource_get_unused(exp, &op_data->op_fid2, + &cancels, LCK_EX, + MDS_INODELOCK_LAYOUT); + } + req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT, 0); - rc = ldlm_prep_enqueue_req(exp, req, NULL, 0); + rc = ldlm_prep_enqueue_req(exp, req, &cancels, count); if (rc) { ptlrpc_request_free(req); return ERR_PTR(rc);