zfs/module
Matthew Macy 8056a75672
Disambiguate condvar API contract
On Illumos callers of cv_timedwait and cv_timedwait_hires
can't distinguish between whether or not the cv was signaled
or the call timed out. Illumos handles this (for some definition
of handles) by calling cv_signal in the return path if we were
signaled but the return value indicates instead that we timed
out. This would make sense if it were possible to query the the
cv for its net signal disposition. However, this isn't possible
and, in spite of the fact that there are places in the code that
clearly take a different and incompatible path if a timeout value
is indicated, this distinction appears to be rather subtle to most
developers. This problem is further compounded by the fact that on
Linux, calling cv_signal in the return path wouldn't even do the
right thing unless there are other waiters.

Since it is possible for the caller to independently determine how
much time is remaining but it is not possible to query if the cv
was in fact signaled, prioritizing signalling over timeout seems
like a cleaner solution. In addition, judging from usage patterns
within the code itself, it is also less error prone.

Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #10471
2020-06-18 10:17:50 -07:00
..
avl Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
icp Add convenience wrappers for common uio usage 2020-06-14 10:09:55 -07:00
lua Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
nvpair Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
os Disambiguate condvar API contract 2020-06-18 10:17:50 -07:00
spl Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
unicode Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
zcommon Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
zfs Disambiguate condvar API contract 2020-06-18 10:17:50 -07:00
.gitignore Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
Kbuild.in Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
Makefile.bsd Combine OS-independent ABD Code into Common Source File 2020-05-10 12:23:52 -07:00
Makefile.in Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00