aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/metaslab.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/zfs/metaslab.c')
-rw-r--r--module/zfs/metaslab.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c
index f9eef272b..43d3b211e 100644
--- a/module/zfs/metaslab.c
+++ b/module/zfs/metaslab.c
@@ -1255,9 +1255,10 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint64_t object, uint64_t txg,
/*
* We only open space map objects that already exist. All others
- * will be opened when we finally allocate an object for it.
+ * will be opened when we finally allocate an object for it. For
+ * readonly pools there is no need to open the space map object.
*/
- if (object != 0) {
+ if (object != 0 && spa_writeable(vd->vdev_spa)) {
error = space_map_open(&ms->ms_sm, mos, object, ms->ms_start,
ms->ms_size, vd->vdev_ashift, &ms->ms_lock);