diff options
author | George Wilson <[email protected]> | 2013-03-03 00:57:39 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-03-04 09:56:13 -0800 |
commit | a4430fce691d492aec382de0dfa937c05ee16500 (patch) | |
tree | fe1008b6ed088cfbca5342d7c8148794febf38bc /module/zfs | |
parent | b01615d5ac86913da1e092d0378bfb8f0e72af30 (diff) |
Merge zvol.c changes from PSARC 2010/306 Read-only ZFS pools
The changes to zvol.c were never merged from the last onnv_147
bulk update. This was because zvol.c was largely rewritten
for Linux making it fairly easy to miss these sorts of changes.
This causes a regression when importing a zpool with zvols
read-only. This does not impact pool which only contain
filesystem datasets.
References:
illumos/illumos-gate@f9af39b
Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1332
Closes #1333
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/zvol.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c index f8e325676..b0d59fe0c 100644 --- a/module/zfs/zvol.c +++ b/module/zfs/zvol.c @@ -941,7 +941,8 @@ zvol_first_open(zvol_state_t *zv) zv->zv_zilog = zil_open(os, zvol_get_data); VERIFY(dsl_prop_get_integer(zv->zv_name, "readonly", &ro, NULL) == 0); - if (ro || dmu_objset_is_snapshot(os)) { + if (ro || dmu_objset_is_snapshot(os) || + !spa_writeable(dmu_objset_spa(os))) { set_disk_ro(zv->zv_disk, 1); zv->zv_flags |= ZVOL_RDONLY; } else { @@ -1352,10 +1353,12 @@ __zvol_create_minor(const char *name) queue_flag_set_unlocked(QUEUE_FLAG_NONROT, zv->zv_queue); #endif - if (zil_replay_disable) - zil_destroy(dmu_objset_zil(os), B_FALSE); - else - zil_replay(os, zv, zvol_replay_vector); + if (spa_writeable(dmu_objset_spa(os))) { + if (zil_replay_disable) + zil_destroy(dmu_objset_zil(os), B_FALSE); + else + zil_replay(os, zv, zvol_replay_vector); + } zv->zv_objset = NULL; out_dmu_objset_disown: |