summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre
diff options
context:
space:
mode:
authorAlexander Boyko <alexander_boyko@xyratex.com>2016-05-04 10:28:53 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-05-09 14:01:14 +0200
commit219eeac841fb8fd70b73bec9c986c2d0044faf92 (patch)
tree7124968a6886e1cefb626404e2056875901da4be /drivers/staging/lustre
parent1e5a6fa96689232faf92b2352dd4bb0fda28b37e (diff)
staging: lustre: osc: Allow lock to be canceled at ENQ time
A cl_lock can be canceled when it's in CLS_ENQUEUED state. We can't unuse this kind of lock in lov_lock_unuse() because it will bring this lock into CLS_NEW state and then confuse osc_lock_upcall(). Add a regression test case by Alexander Boyko. Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com> Signed-off-by: Alexander Boyko <alexander_boyko@xyratex.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3889 Reviewed-on: http://review.whamcloud.com/8405 Reviewed-by: Bobi Jam <bobijam@gmail.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r--drivers/staging/lustre/lustre/include/obd_support.h1
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_request.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 1358af19530e..60034d39b00d 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -321,6 +321,7 @@ extern char obd_jobid_var[];
#define OBD_FAIL_LDLM_AGL_DELAY 0x31a
#define OBD_FAIL_LDLM_AGL_NOLOCK 0x31b
#define OBD_FAIL_LDLM_OST_LVB 0x31c
+#define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d
/* LOCKLESS IO */
#define OBD_FAIL_LDLM_SET_CONTENTION 0x385
diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c
index df06f4f103e4..47417f88fe3c 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -2201,6 +2201,9 @@ static int osc_enqueue_interpret(const struct lu_env *env,
*/
ldlm_lock_addref(lockh, mode);
+ /* Let cl_lock_state_wait fail with -ERESTARTSYS to unuse sublocks. */
+ OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_ENQUEUE_HANG, 2);
+
/* Let CP AST to grant the lock first. */
OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_ENQ_RACE, 1);