aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers
diff options
context:
space:
mode:
authorAndriy Skulysh <andriy.skulysh@seagate.com>2016-06-20 16:55:50 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-20 14:28:39 -0700
commit025fd3c20bfb4e84972f174c7246f86d693f6544 (patch)
tree0bb4acf98a915fcd4874430b18fc086803beda2f /drivers
parentstaging/lustre: Add documentation for unstable_stats in sysfs (diff)
downloadwireguard-linux-025fd3c20bfb4e84972f174c7246f86d693f6544.tar.xz
wireguard-linux-025fd3c20bfb4e84972f174c7246f86d693f6544.zip
staging/lustre/osc: glimpse lock should match only with granted locks
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_request.c8
1 files 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 933434946d5b..536b868ff776 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;