-
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
zio: Avoid sleeping in the I/O path #16785
Conversation
zio_delay_interrupt(), apparently used for fault injection, is executed in the I/O pipeline. It can cause the calling thread to go to sleep, which is not allowed on FreeBSD. This happens only for small delays, though, and there's no apparent reason to avoid deferring to a taskqueue in that case, as it already does otherwise. Simply go to sleep unconditionally. This fixes an occasional panic I see when running the ZTS on FreeBSD. Also remove an unhelpful comment referencing the non-existent timeout_generic(). Signed-off-by: Mark Johnston <[email protected]>
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.
Makes sense to me. Just makes me wonder about usefulness of higher-resolution taskq_dispatch_delay() variant. FreeBSD could do it easily.
Looking at the existing callers, I don't see much demand for higher-resolution timeouts. Though, ddi_get_lbolt64() seems fairly coarse on FreeBSD, I guess the maximum resolution there is ~10us. |
zio_delay_interrupt(), apparently used for fault injection, is executed in the I/O pipeline. It can cause the calling thread to go to sleep, which is not allowed on FreeBSD. This happens only for small delays, though, and there's no apparent reason to avoid deferring to a taskqueue in that case, as it already does otherwise. Simply go to sleep unconditionally. This fixes an occasional panic I see when running the ZTS on FreeBSD. Also remove an unhelpful comment referencing the non-existent timeout_generic(). Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Mark Johnston <[email protected]> Closes openzfs#16785
zio_delay_interrupt(), apparently used for fault injection, is executed in the I/O pipeline. It can cause the calling thread to go to sleep, which is not allowed on FreeBSD. This happens only for small delays, though, and there's no apparent reason to avoid deferring to a taskqueue in that case, as it already does otherwise. Simply go to sleep unconditionally. This fixes an occasional panic I see when running the ZTS on FreeBSD. Also remove an unhelpful comment referencing the non-existent timeout_generic(). Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Mark Johnston <[email protected]> Closes openzfs#16785
The change modifies zio_delay_interrupt(), used in testing environments, to avoid sleeping, as this is not allowed on FreeBSD.
Motivation and Context
When running the ZTS in a FreeBSD VM, I often see the following panic:
In particular, we shouldn't assume that it's ok to sleep in I/O completion threads.
This change modifies zio_delay_interrupt() to avoid violating this invariant.
Description
The patch removes a special case in zio_delay_interrupt() such that the I/O is always deferred to a taskqueue.
How Has This Been Tested?
I've run through the ZTS on FreeBSD with this patch.
Types of changes
Checklist:
Signed-off-by
.