Skip to content

Commit adfe9d9

Browse files
skiselkovbehlendorf
authored andcommitted
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 <alek.pinchuk@nexenta.com> Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com> Reviewed by: Prashanth Sreenivasa <prashksp@gmail.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Dan McDonald <danmcd@omniti.com> Reviewed by: Steven Hartland <steven.hartland@multiplay.co.uk> Approved by: Matthew Ahrens <mahrens@delphix.com> References: https://www.illumos.org/issues/6367 illumos/illumos-gate@e495b6e Ported-by: kernelOfTruth kerneloftruth@gmail.com Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
1 parent 5f3d9c6 commit adfe9d9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

module/zfs/spa_misc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/*
2222
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
2323
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
24-
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24+
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
2525
* Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
2626
*/
2727

@@ -385,14 +385,16 @@ spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw)
385385
if (rw == RW_READER) {
386386
if (scl->scl_writer || scl->scl_write_wanted) {
387387
mutex_exit(&scl->scl_lock);
388-
spa_config_exit(spa, locks ^ (1 << i), tag);
388+
spa_config_exit(spa, locks & ((1 << i) - 1),
389+
tag);
389390
return (0);
390391
}
391392
} else {
392393
ASSERT(scl->scl_writer != curthread);
393394
if (!refcount_is_zero(&scl->scl_count)) {
394395
mutex_exit(&scl->scl_lock);
395-
spa_config_exit(spa, locks ^ (1 << i), tag);
396+
spa_config_exit(spa, locks & ((1 << i) - 1),
397+
tag);
396398
return (0);
397399
}
398400
scl->scl_writer = curthread;

0 commit comments

Comments
 (0)