From 51f23ffa4dae3015da627203fb6f160db4911bee Mon Sep 17 00:00:00 2001 From: Vitaly Fertman Date: Wed, 12 Jun 2019 02:18:45 +0300 Subject: [PATCH] LU-10070 ldlm: layout lock fixes 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 Signed-off-by: Vitaly Fertman Change-Id: I1525153b3a07385fc17ef5416ded7b6d4378b2ec Reviewed-on: https://review.whamcloud.com/35232 Reviewed-by: Patrick Farrell Reviewed-by: Mike Pershin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 3 ++- lustre/mdc/mdc_locks.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index c45090e..1d37ff5 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -5360,7 +5360,8 @@ int ll_layout_refresh(struct inode *inode, __u32 *gen) /* mostly layout lock is caching on the local side, so try to * 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/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index c946fa2..661cb7f 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -588,10 +588,11 @@ 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; ENTRY; req = ptlrpc_request_alloc(class_exp2cliimp(exp), @@ -599,8 +600,15 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp, if (req == NULL) 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)); -- 1.8.3.1