summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorSaso Kiselkov <[email protected]>2015-12-23 21:02:43 +0100
committerBrian Behlendorf <[email protected]>2016-01-12 11:05:28 -0800
commitadfe9d932bb5a4d367f7abe2e3b33fc0363dc815 (patch)
tree0ac9ddb9d6ca485370ff839e2893d7897d8be4a4 /module
parent5f3d9c69d1dda5dce7dc0e4dd007b51a66177f1c (diff)
Illumos 6367 - spa_config_tryenter incorrectly handles the multiple-lock case
6367 spa_config_tryenter incorrectly handles the multiple-lock case Reviewed by: Alek Pinchuk <[email protected]> Reviewed by: Josef 'Jeff' Sipek <[email protected]> Reviewed by: Prashanth Sreenivasa <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Dan McDonald <[email protected]> Reviewed by: Steven Hartland <[email protected]> Approved by: Matthew Ahrens <[email protected]> References: https://www.illumos.org/issues/6367 https://github.com/illumos/illumos-gate/commit/e495b6e Ported-by: kernelOfTruth [email protected] Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r--module/zfs/spa_misc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index 409dce121..ec7c807a4 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
*/
@@ -385,14 +385,16 @@ spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw)
if (rw == RW_READER) {
if (scl->scl_writer || scl->scl_write_wanted) {
mutex_exit(&scl->scl_lock);
- spa_config_exit(spa, locks ^ (1 << i), tag);
+ spa_config_exit(spa, locks & ((1 << i) - 1),
+ tag);
return (0);
}
} else {
ASSERT(scl->scl_writer != curthread);
if (!refcount_is_zero(&scl->scl_count)) {
mutex_exit(&scl->scl_lock);
- spa_config_exit(spa, locks ^ (1 << i), tag);
+ spa_config_exit(spa, locks & ((1 << i) - 1),
+ tag);
return (0);
}
scl->scl_writer = curthread;