-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flush: don't report flush error when disabling flush support #16855
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for remembering it. I am OK about this, but I am not completely certain that unifying this in OS-independent code is the right direction. Different OS and vdev types might have different ways of reporting it. I worry that mapping of Linux EOPNOTSUPP into ENOTSUP is too much of a special case. Or we expect other cases to translate whatever they have into ENOTSUP? If so, then why do we also check for ENOTTY?
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. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
It seems there's no good reason for vdev_disk & vdev_geom to explicitly detect no support for flush and set vdev_nowritecache. Instead, just signal it by setting the error to ENOTSUP, and let zio_vdev_io_assess() take care of it in one place. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
21016c3
to
96adb7e
Compare
Yeah, this is a reasonable point. I've split this PR into two commits. The actual change as described is in the first commit, and could stand alone. The second changes things to make ENOTSUP the only way to signal that flush is not supported. For Linux, we then explicitly check for EOPNOTSUPP and ENOTTY, and convert. I could drop ENOTTY, as it seems to go back to ancient Linux where it was implemented with an ioctl-like interface to the block device, but I haven't done the study to really confirm that. As for EOPNOTSUPP, it's kind of redundant, but you are right that they aren't necessarily the same, and although we mix them throughout the code, we can easily just say that this a first tiny step towards cleaning them all up. Or I can just drop the commit :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but once we go that way, would be nice to also patch zfs_file_deallocate() on both FreeBSD and Linux to use ENOTSUP instead of EOPNOTSUP (I honestly don't know which of them is better, so would be fine either way), plus on FreeBSD we need to map ENODEV into ENOTSUP there too.
It seems there's no good reason for vdev_disk & vdev_geom to explicitly detect no support for flush and set vdev_nowritecache. Instead, just signal it by setting the error to ENOTSUP, and let zio_vdev_io_assess() take care of it in one place. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16855
@amotin agreed. FWIW, POSIX describes
So I prefer |
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. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes openzfs#16855
It seems there's no good reason for vdev_disk & vdev_geom to explicitly detect no support for flush and set vdev_nowritecache. Instead, just signal it by setting the error to ENOTSUP, and let zio_vdev_io_assess() take care of it in one place. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes openzfs#16855
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. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes openzfs#16855
It seems there's no good reason for vdev_disk & vdev_geom to explicitly detect no support for flush and set vdev_nowritecache. Instead, just signal it by setting the error to ENOTSUP, and let zio_vdev_io_assess() take care of it in one place. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes openzfs#16855
[Sponsors: Klara, Inc., Wasabi Technology, Inc.]
Motivation and Context
The first time a device returns
ENOTSUP
in repsonse to a flush request, we setvdev_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!Description
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 tozio_vdev_io_assess()
will cause it all to fall out nicely. So remove those checks.This patch was suggested by @amotin in #16314. I'm unlikely to continue with that PR in that form, but this patch is still good and will be wanted when we do stat paying attention to flush errors. No reason not to include it now and get it off my plate!
How Has This Been Tested?
Direct testing against various unpublished flush error-response prototypes. Hard to test in OpenZFS proper, since nothing responds to flush errors.
Successful ZTS run against Linux 6.1.
Types of changes
Checklist:
Signed-off-by
.