mirror of https://gitee.com/openkylin/linux.git
staging: lustre: remove back_to_sleep()
When 'back_to_sleep()' is passed as the 'timeout' function, the effect is to wait indefinitely for the event, polling once after the timeout. If LWI_ON_SIGNAL_NOOP is given, then after the timeout we allow fatal signals to interrupt the wait. Make this more obvious in both places "back_to_sleep()" is used but using two explicit sleeps. The code in ptlrpcd_add_req() looks odd - why not just have one wait_event_idle()? However I believe this is a faithful transformation of the existing code. Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4796293a7a
commit
cac6e45735
|
@ -140,10 +140,6 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id);
|
|||
* XXX nikita: some ptlrpc daemon threads have races of that sort.
|
||||
*
|
||||
*/
|
||||
static inline int back_to_sleep(void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define LWI_ON_SIGNAL_NOOP ((void (*)(void *))(-1))
|
||||
|
||||
|
|
|
@ -1496,7 +1496,6 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose)
|
|||
}
|
||||
|
||||
if (ptlrpc_import_in_recovery(imp)) {
|
||||
struct l_wait_info lwi;
|
||||
long timeout;
|
||||
|
||||
if (AT_OFF) {
|
||||
|
@ -1510,10 +1509,12 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose)
|
|||
timeout = at_get(&imp->imp_at.iat_service_estimate[idx]) * HZ;
|
||||
}
|
||||
|
||||
lwi = LWI_TIMEOUT_INTR(cfs_timeout_cap(timeout),
|
||||
back_to_sleep, LWI_ON_SIGNAL_NOOP, NULL);
|
||||
rc = l_wait_event(imp->imp_recovery_waitq,
|
||||
!ptlrpc_import_in_recovery(imp), &lwi);
|
||||
if (wait_event_idle_timeout(imp->imp_recovery_waitq,
|
||||
!ptlrpc_import_in_recovery(imp),
|
||||
cfs_timeout_cap(timeout)) == 0)
|
||||
l_wait_event_abortable(
|
||||
imp->imp_recovery_waitq,
|
||||
!ptlrpc_import_in_recovery(imp));
|
||||
}
|
||||
|
||||
spin_lock(&imp->imp_lock);
|
||||
|
|
|
@ -230,12 +230,13 @@ void ptlrpcd_add_req(struct ptlrpc_request *req)
|
|||
|
||||
spin_lock(&req->rq_lock);
|
||||
if (req->rq_invalid_rqset) {
|
||||
struct l_wait_info lwi = LWI_TIMEOUT(5 * HZ,
|
||||
back_to_sleep, NULL);
|
||||
|
||||
req->rq_invalid_rqset = 0;
|
||||
spin_unlock(&req->rq_lock);
|
||||
l_wait_event(req->rq_set_waitq, !req->rq_set, &lwi);
|
||||
if (wait_event_idle_timeout(req->rq_set_waitq,
|
||||
!req->rq_set,
|
||||
5 * HZ) == 0)
|
||||
wait_event_idle(req->rq_set_waitq,
|
||||
!req->rq_set);
|
||||
} else if (req->rq_set) {
|
||||
/* If we have a valid "rq_set", just reuse it to avoid double
|
||||
* linked.
|
||||
|
|
Loading…
Reference in New Issue