From 298ec40b6d9edcbde7b1fbbf172bd05be0eb9b97 Mon Sep 17 00:00:00 2001 From: George Melikov Date: Sat, 4 Feb 2017 20:23:50 +0300 Subject: [PATCH] OpenZFS 7448 - ZFS doesn't notice when disk vdevs have no write cache Authored by: Hans Rosenfeld Reviewed by: Dan Fields Reviewed by: Alek Pinchuk Reviewed by: George Wilson Approved by: Dan McDonald Reviewed-by: Don Brady Reviewed-by: Tim Chase Reviewed-by: Brian Behlendorf Ported-by: George Melikov OpenZFS-issue: https://www.illumos.org/issues/7448 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/295438b Closes #5737 --- module/zfs/vdev_disk.c | 2 -- module/zfs/zio.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c index d096d754f..33b7f5d15 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 577ee7694..003940795 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;