LU-9679 osc: convert cl_cache_waiters to a wait_queue.
cli->cl_cache_waiters is a list of tasks that need
to be woken when grant-space becomes available. This
means it is acting much like a wait queue.
So let's change it to really be a wait queue.
The current implementation adds new waiters to the end of the list,
and calls osc_enter_cache_try() on each in order. We can provide the
same behaviour by using an exclusive wait, and having each waiter wake
the next task when it succeeds.
If a waiter notices that success has become impossible, it wakes all
other waiters.
If a waiter times out, it doesn't wake other - just leaves them to
time out themselves.
Note that the old code handled -EINTR from the wait function. That is
not a possible return value when wait_event_idle* is used, so that
case is discarded.
As we need wait_event_idle_exclusive_timeout_cmd(), we should fix the
bug in that macro - the "might_sleep()" is wrong, as a spinlock might
be held at that point.
Linux-Commit:
31f45f56ecdf ("lustre: osc_cache: convert
cl_cache_waiters to a wait_queue.")
Lustre-change: https://review.whamcloud.com/37605
Lustre-commit:
b2ede01d1ed77ddc512c013220f6ea8b509e9541
Change-Id: Ib7622ea2daea8f6e59bef95d3b6c5a80d209b81e
Signed-off-by: Mr NeilBrown <neilb@suse.com>
Reviewed-on: https://review.whamcloud.com/38575
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>