diff --git a/module/zfs/zil.c b/module/zfs/zil.c index 8742fc662..7ad0fb344 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -1622,7 +1622,7 @@ zil_lwb_write_done(zio_t *zio) while ((zv = avl_destroy_nodes(t, &cookie)) != NULL) { vdev_t *vd = vdev_lookup_top(spa, zv->zv_vdev); - if (vd != NULL && !vd->vdev_nowritecache) { + if (vd != NULL) { /* * The "ZIO_FLAG_DONT_PROPAGATE" is currently * always used within "zio_flush". This means, diff --git a/module/zfs/zio.c b/module/zfs/zio.c index d8eb075ee..d0b401623 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -1435,23 +1435,10 @@ zio_t * zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd, zio_done_func_t *done, void *private, zio_flag_t flags) { - zio_t *zio; - int c; - - if (vd->vdev_children == 0) { - zio = zio_create(pio, spa, 0, NULL, NULL, 0, 0, done, private, - ZIO_TYPE_IOCTL, ZIO_PRIORITY_NOW, flags, vd, 0, NULL, - ZIO_STAGE_OPEN, ZIO_IOCTL_PIPELINE); - - zio->io_cmd = cmd; - } else { - zio = zio_null(pio, spa, NULL, NULL, NULL, flags); - - for (c = 0; c < vd->vdev_children; c++) - zio_nowait(zio_ioctl(zio, spa, vd->vdev_child[c], cmd, - done, private, flags)); - } - + zio_t *zio = zio_create(pio, spa, 0, NULL, NULL, 0, 0, done, private, + ZIO_TYPE_IOCTL, ZIO_PRIORITY_NOW, flags, vd, 0, NULL, + ZIO_STAGE_OPEN, ZIO_IOCTL_PIPELINE); + zio->io_cmd = cmd; return (zio); } @@ -1622,11 +1609,18 @@ zio_vdev_delegated_io(vdev_t *vd, uint64_t offset, abd_t *data, uint64_t size, } void -zio_flush(zio_t *zio, vdev_t *vd) +zio_flush(zio_t *pio, vdev_t *vd) { - zio_nowait(zio_ioctl(zio, zio->io_spa, vd, DKIOCFLUSHWRITECACHE, - NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY)); + if (vd->vdev_nowritecache) + return; + if (vd->vdev_children == 0) { + zio_nowait(zio_ioctl(pio, vd->vdev_spa, vd, + DKIOCFLUSHWRITECACHE, NULL, NULL, ZIO_FLAG_CANFAIL | + ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY)); + } else { + for (uint64_t c = 0; c < vd->vdev_children; c++) + zio_flush(pio, vd->vdev_child[c]); + } } void