]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Don't upgrade a metaslab when the pool is not writable
authorTim Chase <tim@chase2k.com>
Thu, 14 Aug 2014 12:01:20 +0000 (07:01 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 18 Aug 2014 15:47:19 +0000 (08:47 -0700)
Illumos 4982 added code to metaslab_fragmentation() to proactively update
space maps when the spacemap_histogram feature is enabled.  This should
only happen when the pool is writeable.

References:
  https://www.illumos.org/issues/4982
  https://github.com/illumos/illumos-gate/commit/2e4c998

Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2595

module/zfs/metaslab.c

index 68a1591c2e5784e949bde4cfe5e3f7f8926033f3..098d73f952e94be991d8b0e1ea8a641f2eb5cf8e 100644 (file)
@@ -1395,13 +1395,16 @@ metaslab_fragmentation(metaslab_t *msp)
         * so that we upgrade next time we encounter it.
         */
        if (msp->ms_sm->sm_dbuf->db_size != sizeof (space_map_phys_t)) {
-               uint64_t txg = spa_syncing_txg(spa);
                vdev_t *vd = msp->ms_group->mg_vd;
 
-               msp->ms_condense_wanted = B_TRUE;
-               vdev_dirty(vd, VDD_METASLAB, msp, txg + 1);
-               spa_dbgmsg(spa, "txg %llu, requesting force condense: "
-                   "msp %p, vd %p", txg, msp, vd);
+               if (spa_writeable(vd->vdev_spa)) {
+                       uint64_t txg = spa_syncing_txg(spa);
+
+                       msp->ms_condense_wanted = B_TRUE;
+                       vdev_dirty(vd, VDD_METASLAB, msp, txg + 1);
+                       spa_dbgmsg(spa, "txg %llu, requesting force condense: "
+                           "msp %p, vd %p", txg, msp, vd);
+               }
                return (ZFS_FRAG_INVALID);
        }