Skip to content

Commit 21016c3

Browse files
committed
flush: don't report flush error when disabling flush support
The first time a device returns ENOTSUP in repsonse to a flush request, we set vdev_nowritecache so we don't issue flushes in the future and instead just pretend the succeeded. However, we still return an error for the initial flush, even though we just decided such errors are meaningless! So, when setting vdev_nowritecache in response to a flush error, also reset the error code to assume success. Along the way, it seems there's no good reason for vdev_disk & vdev_geom to explicitly detect no support for flush and set vdev_nowritecache; just letting the error through to zio_vdev_io_assess() will cause it all to fall out nicely. So remove those checks. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
1 parent e0039c7 commit 21016c3

File tree

3 files changed

+5
-20
lines changed

3 files changed

+5
-20
lines changed

module/os/freebsd/zfs/vdev_geom.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,21 +1014,6 @@ vdev_geom_io_intr(struct bio *bp)
10141014
zio->io_error = SET_ERROR(EIO);
10151015

10161016
switch (zio->io_error) {
1017-
case ENOTSUP:
1018-
/*
1019-
* If we get ENOTSUP for BIO_FLUSH or BIO_DELETE we know
1020-
* that future attempts will never succeed. In this case
1021-
* we set a persistent flag so that we don't bother with
1022-
* requests in the future.
1023-
*/
1024-
switch (bp->bio_cmd) {
1025-
case BIO_FLUSH:
1026-
vd->vdev_nowritecache = B_TRUE;
1027-
break;
1028-
case BIO_DELETE:
1029-
break;
1030-
}
1031-
break;
10321017
case ENXIO:
10331018
if (!vd->vdev_remove_wanted) {
10341019
/*

module/os/linux/zfs/vdev_disk.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,6 @@ vdev_disk_io_flush_completion(struct bio *bio)
11991199
zio_t *zio = bio->bi_private;
12001200
zio->io_error = bi_status_to_errno(bio->bi_status);
12011201

1202-
if (zio->io_error && (zio->io_error == EOPNOTSUPP))
1203-
zio->io_vd->vdev_nowritecache = B_TRUE;
1204-
12051202
bio_put(bio);
12061203
ASSERT3S(zio->io_error, >=, 0);
12071204
if (zio->io_error)

module/zfs/zio.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4608,11 +4608,14 @@ zio_vdev_io_assess(zio_t *zio)
46084608
/*
46094609
* If a cache flush returns ENOTSUP or ENOTTY, we know that no future
46104610
* attempts will ever succeed. In this case we set a persistent
4611-
* boolean flag so that we don't bother with it in the future.
4611+
* boolean flag so that we don't bother with it in the future, and
4612+
* then we act like the flush succeeded.
46124613
*/
46134614
if ((zio->io_error == ENOTSUP || zio->io_error == ENOTTY) &&
4614-
zio->io_type == ZIO_TYPE_FLUSH && vd != NULL)
4615+
zio->io_type == ZIO_TYPE_FLUSH && vd != NULL) {
46154616
vd->vdev_nowritecache = B_TRUE;
4617+
zio->io_error = 0;
4618+
}
46164619

46174620
if (zio->io_error)
46184621
zio->io_pipeline = ZIO_INTERLOCK_PIPELINE;

0 commit comments

Comments
 (0)