Matthew Ahrens 53dce5acc6 panic in removal_remap test on 4K devices
If the zfs_remove_max_segment tunable is changed to be not a multiple of
the sector size, then the device removal code will malfunction and try
to create mappings that are smaller than one sector, leading to a panic.

On debug bits this assertion will fail in spa_vdev_copy_segment():
    ASSERT3U(DVA_GET_ASIZE(&dst), ==, size);

On nondebug, the system panics with a stack like:
    metaslab_free_concrete()
    metaslab_free_impl()
    metaslab_free_impl_cb()
    vdev_indirect_remap()
    free_from_removing_vdev()
    metaslab_free_impl()
    metaslab_free_dva()
    metaslab_free()

Fortunately, the default for zfs_remove_max_segment is 1MB, so this
can't occur by default.  We hit it during this test because
removal_remap.ksh changes zfs_remove_max_segment to 1KB. When testing on
4KB-sector disks, we hit the bug.

This change makes the zfs_remove_max_segment tunable more robust,
automatically rounding it up to a multiple of the sector size. We also
turn some key assertions into VERIFY's so that similar bugs would be
caught before they are encoded on disk (and thus avoid a
panic-reboot-loop).

Reviewed-by: Sean Eric Fagan <sef@ixsystems.com>
Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed-by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
External-issue: DLPX-61342
Closes #8893
2019-06-13 13:12:39 -07:00
..
2019-05-07 15:18:44 -07:00
2019-03-29 09:13:20 -07:00
2017-10-05 19:28:00 -07:00
2016-01-08 15:08:19 -08:00
2019-05-07 15:18:44 -07:00
2018-09-05 18:33:36 -07:00
2019-05-07 15:18:44 -07:00
2018-10-09 14:05:13 -07:00
2019-05-07 15:18:44 -07:00
2019-05-07 15:18:44 -07:00
2019-03-13 10:58:39 -07:00
2018-10-01 10:40:11 -07:00
2013-11-04 11:17:48 -08:00
2017-01-03 11:31:18 -06:00
2017-12-07 10:28:50 -08:00
2017-10-11 16:54:48 -04:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2018-05-29 16:00:33 -07:00
2018-10-03 15:30:55 -07:00
2016-04-21 09:49:25 -07:00
2016-06-07 09:16:52 -07:00
2018-02-13 14:54:54 -08:00
2019-03-29 09:13:20 -07:00
2019-05-09 10:08:05 -07:00
2015-01-06 16:53:24 -08:00
2019-03-29 09:13:20 -07:00
2017-07-13 13:54:00 -04:00
2013-11-04 10:55:25 -08:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2019-06-12 13:13:09 -07:00
2018-02-08 15:28:18 -08:00
2018-02-08 15:28:18 -08:00
2018-06-15 15:10:42 -07:00
2018-02-13 14:54:54 -08:00
2017-03-10 09:51:33 -08:00
2019-03-29 09:13:20 -07:00
2018-05-29 16:00:33 -07:00
2018-05-29 16:00:33 -07:00
2019-05-07 15:18:44 -07:00
2018-02-13 14:54:54 -08:00
2018-02-13 14:54:54 -08:00
2018-09-06 21:44:52 -07:00
2019-06-10 11:48:42 -07:00
2019-06-10 11:48:42 -07:00
2017-03-29 12:24:51 -07:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2017-07-12 13:05:37 -07:00