Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1427060

[PATCH v2 27/29] staging/lustre/osc: glimpse lock should match only with granted locks

From Oleg Drokin <green@linuxhacker.ru>
Newsgroups linux.kernel
Subject [PATCH v2 27/29] staging/lustre/osc: glimpse lock should match only with granted locks
Date 2016-06-20 23:20 +0200
Message-ID <rMeLT-52j-11@gated-at.bofh.it> (permalink)
References <rMesx-4Gc-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Andriy Skulysh <andriy.skulysh@seagate.com>

A deadlock is possible during ccc_prep_size()->ldlm_lock_match() vs
cl_io_lock() which is waiting for a matched lock and conflicts with
already taken lock before ccc_prep_size().

It is better to send an additional lock request to avoid deadlock.

Seagate-bug-id: MRP-3312
Signed-off-by: Andriy Skulysh <andriy.skulysh@seagate.com>
Reviewed-on: http://review.whamcloud.com/18738
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7829
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
 drivers/staging/lustre/lustre/osc/osc_request.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c
index 9334349..536b868 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -2246,7 +2246,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
 	struct lustre_handle lockh = { 0 };
 	struct ptlrpc_request *req = NULL;
 	int intent = *flags & LDLM_FL_HAS_INTENT;
-	__u64 match_lvb = agl ? 0 : LDLM_FL_LVB_READY;
+	__u64 match_flags = *flags;
 	enum ldlm_mode mode;
 	int rc;
 
@@ -2281,7 +2281,11 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
 	mode = einfo->ei_mode;
 	if (einfo->ei_mode == LCK_PR)
 		mode |= LCK_PW;
-	mode = ldlm_lock_match(obd->obd_namespace, *flags | match_lvb, res_id,
+	if (agl == 0)
+		match_flags |= LDLM_FL_LVB_READY;
+	if (intent != 0)
+		match_flags |= LDLM_FL_BLOCK_GRANTED;
+	mode = ldlm_lock_match(obd->obd_namespace, match_flags, res_id,
 			       einfo->ei_type, policy, mode, &lockh, 0);
 	if (mode) {
 		struct ldlm_lock *matched;
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/29] Lustre fixes Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:10 +0200
  [PATCH v2 23/29] staging/lustre/llite: ll_revalidate_dentry update Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:10 +0200
  [PATCH v2 24/29] staging/lustre/llite: IOC_MDC_GETFILEINFO returns the wrong ino Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:20 +0200
  [PATCH v2 05/29] staging/lustre/osc: osc_lock_weight endless loop fix Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:20 +0200
  [PATCH v2 18/29] staging/lustre/ldlm: const qualify struct lustre_handle * params Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:20 +0200
  [PATCH v2 17/29] staging/lustre/llite: change it_data to it_request Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:20 +0200
  [PATCH v2 27/29] staging/lustre/osc: glimpse lock should match only with granted locks Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:20 +0200
  [PATCH v2 08/29] staging/lustre/ptlrpc: missing wakeup for ptlrpc_check_set Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:20 +0200
  [PATCH v2 22/29] staging/lustre/llite: Restore proper opencache operations Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:20 +0200
  [PATCH v2 04/29] staging/lustre/llite: lock i_lock before __d_drop() Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:20 +0200
  [PATCH v2 01/29] staging/lustre/llite: allocate and free client cache asynchronously Oleg Drokin <green@linuxhacker.ru> - 2016-06-20 23:20 +0200
  [PATCH v2 28/29] staging/lustre/libcfs: Do not call kthread_run in wrong state Oleg Drokin <green@linuxhacker.ru> - 2016-06-21 00:10 +0200
  [PATCH v2 06/29] staging/lustre/osc: Fix reverted condition in osc_lock_weight Oleg Drokin <green@linuxhacker.ru> - 2016-06-21 00:10 +0200
  [PATCH v2 07/29] staging/lustre/ptlrpc: reorganize ptlrpc_request Oleg Drokin <green@linuxhacker.ru> - 2016-06-21 00:10 +0200

csiph-web