Skip to content

Commit 6f08143

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 4f4f6a3 commit 6f08143

File tree

3 files changed

+5
-20
lines changed

3 files changed

+5
-20
lines changed

module/os/freebsd/zfs/vdev_geom.c

-15
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

-3
Original file line numberDiff line numberDiff line change
@@ -1232,9 +1232,6 @@ BIO_END_IO_PROTO(vdev_disk_io_flush_completion, bio, error)
12321232
zio->io_error = -error;
12331233
#endif
12341234

1235-
if (zio->io_error && (zio->io_error == EOPNOTSUPP))
1236-
zio->io_vd->vdev_nowritecache = B_TRUE;
1237-
12381235
bio_put(bio);
12391236
ASSERT3S(zio->io_error, >=, 0);
12401237
if (zio->io_error)

module/zfs/zio.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -4274,11 +4274,14 @@ zio_vdev_io_assess(zio_t *zio)
42744274
/*
42754275
* If a cache flush returns ENOTSUP or ENOTTY, we know that no future
42764276
* attempts will ever succeed. In this case we set a persistent
4277-
* boolean flag so that we don't bother with it in the future.
4277+
* boolean flag so that we don't bother with it in the future, and
4278+
* then we act like the flush succeeded.
42784279
*/
42794280
if ((zio->io_error == ENOTSUP || zio->io_error == ENOTTY) &&
4280-
zio->io_type == ZIO_TYPE_FLUSH && vd != NULL)
4281+
zio->io_type == ZIO_TYPE_FLUSH && vd != NULL) {
42814282
vd->vdev_nowritecache = B_TRUE;
4283+
zio->io_error = 0;
4284+
}
42824285

42834286
if (zio->io_error)
42844287
zio->io_pipeline = ZIO_INTERLOCK_PIPELINE;

0 commit comments

Comments
 (0)