diff options
-rw-r--r-- | module/zfs/vdev_raidz.c | 8 | ||||
-rw-r--r-- | module/zfs/zio.c | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/module/zfs/vdev_raidz.c b/module/zfs/vdev_raidz.c index 5941e645e750..71c4bfbdaf00 100644 --- a/module/zfs/vdev_raidz.c +++ b/module/zfs/vdev_raidz.c @@ -2257,6 +2257,14 @@ vdev_raidz_asize_to_psize(vdev_t *vd, uint64_t asize, uint64_t txg) ASSERT0(asize % (1 << ashift)); psize = (asize >> ashift); + /* + * If the roundup to nparity + 1 caused us to spill into a new row, we + * need to ignore that row entirely (since it can't store data or + * parity). + */ + uint64_t rows = psize / cols; + psize = psize - (rows * cols) <= nparity ? rows * cols : psize; + /* Subtract out parity sectors for each row storing data. */ psize -= nparity * DIV_ROUND_UP(psize, cols); psize <<= ashift; diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 9d80062e54ab..6d7bce8b0e10 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -3239,6 +3239,7 @@ zio_write_gang_block(zio_t *pio, metaslab_class_t *mc) uint64_t psize = allocated ? MIN(resid, allocated_size) : min_size; + ASSERT3U(psize, >=, min_size); zio_t *cio = zio_write(zio, spa, txg, bp, has_data ? abd_get_offset(pio->io_abd, pio->io_size - resid) : NULL, |