diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c index d096d754f7..33b7f5d155 100644 --- a/module/zfs/vdev_disk.c +++ b/module/zfs/vdev_disk.c @@ -693,8 +693,6 @@ vdev_disk_io_start(zio_t *zio) return; zio->io_error = error; - if (error == ENOTSUP) - v->vdev_nowritecache = B_TRUE; break; diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 577ee76945..0039407953 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -3393,6 +3393,16 @@ zio_vdev_io_assess(zio_t *zio) vd->vdev_cant_write = B_TRUE; } + /* + * If a cache flush returns ENOTSUP or ENOTTY, we know that no future + * attempts will ever succeed. In this case we set a persistent bit so + * that we don't bother with it in the future. + */ + if ((zio->io_error == ENOTSUP || zio->io_error == ENOTTY) && + zio->io_type == ZIO_TYPE_IOCTL && + zio->io_cmd == DKIOCFLUSHWRITECACHE && vd != NULL) + vd->vdev_nowritecache = B_TRUE; + if (zio->io_error) zio->io_pipeline = ZIO_INTERLOCK_PIPELINE;