summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/zfs/vdev_label.c
diff options
context:
space:
mode:
authorGeorge Wilson <George.Wilson@Sun.COM>2010-08-09 12:39:28 -0700
committerGeorge Wilson <George.Wilson@Sun.COM>2010-08-09 12:39:28 -0700
commitf9af39bacaaa0f9dda3b75ff6858b9f3988a39af (patch)
treedf029ea20dd96b38eb445238eac477c8bbad67d0 /usr/src/uts/common/fs/zfs/vdev_label.c
parent699ea13a6873ef2e74fc86120b70e60cd3a70f89 (diff)
downloadillumos-joyent-f9af39bacaaa0f9dda3b75ff6858b9f3988a39af.tar.gz
PSARC 2010/306 Read-only ZFS pools
6720531 ZFS should provide read-only import
Diffstat (limited to 'usr/src/uts/common/fs/zfs/vdev_label.c')
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_label.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/usr/src/uts/common/fs/zfs/vdev_label.c b/usr/src/uts/common/fs/zfs/vdev_label.c
index ec5ec6ee34..c08ed8ba04 100644
--- a/usr/src/uts/common/fs/zfs/vdev_label.c
+++ b/usr/src/uts/common/fs/zfs/vdev_label.c
@@ -574,6 +574,15 @@ vdev_inuse(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason,
return (B_TRUE);
/*
+ * We can't rely on a pool's state if it's been imported
+ * read-only. Instead we look to see if the pools is marked
+ * read-only in the namespace and set the state to active.
+ */
+ if ((spa = spa_by_guid(pool_guid, device_guid)) != NULL &&
+ spa_mode(spa) == FREAD)
+ state = POOL_STATE_ACTIVE;
+
+ /*
* If the device is marked ACTIVE, then this device is in use by another
* pool on the system.
*/