diff options
author | NeilBrown <neilb@suse.com> | 2018-02-13 00:47:59 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-16 15:19:11 +0100 |
commit | fdeb5f9a515e91f5908f46d56ba3d4ed76eb041e (patch) | |
tree | c2c4352ea9281bd2697b8a6d97a049c129522d54 /drivers | |
parent | staging: lustre: use wait_event_idle_timeout in ptlrpcd() (diff) | |
download | linux-fdeb5f9a515e91f5908f46d56ba3d4ed76eb041e.tar.xz linux-fdeb5f9a515e91f5908f46d56ba3d4ed76eb041e.zip |
staging: lustre: improve waiting in sptlrpc_req_refresh_ctx
Replace l_wait_event with wait_event_idle_timeout() and call the
handler function explicitly. This makes it more clear
what is happening.
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/sec.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 617e004d00f8..90e3b3022106 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -554,9 +554,8 @@ int ctx_check_refresh(struct ptlrpc_cli_ctx *ctx) } static -int ctx_refresh_timeout(void *data) +int ctx_refresh_timeout(struct ptlrpc_request *req) { - struct ptlrpc_request *req = data; int rc; /* conn_cnt is needed in expire_one_request */ @@ -575,10 +574,8 @@ int ctx_refresh_timeout(void *data) } static -void ctx_refresh_interrupt(void *data) +void ctx_refresh_interrupt(struct ptlrpc_request *req) { - struct ptlrpc_request *req = data; - spin_lock(&req->rq_lock); req->rq_intr = 1; spin_unlock(&req->rq_lock); @@ -611,7 +608,6 @@ int sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout) { struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx; struct ptlrpc_sec *sec; - struct l_wait_info lwi; int rc; LASSERT(ctx); @@ -743,10 +739,28 @@ again: req->rq_restart = 0; spin_unlock(&req->rq_lock); - lwi = LWI_TIMEOUT_INTR(msecs_to_jiffies(timeout * MSEC_PER_SEC), - ctx_refresh_timeout, ctx_refresh_interrupt, - req); - rc = l_wait_event(req->rq_reply_waitq, ctx_check_refresh(ctx), &lwi); + rc = wait_event_idle_timeout(req->rq_reply_waitq, + ctx_check_refresh(ctx), + timeout * HZ); + if (rc == 0 && ctx_refresh_timeout(req) == 0) { + /* Keep waiting, but enable some signals */ + rc = l_wait_event_abortable(req->rq_reply_waitq, + ctx_check_refresh(ctx)); + if (rc == 0) + rc = 1; + } + + if (rc > 0) + /* condition is true */ + rc = 0; + else if (rc == 0) + /* Timed out */ + rc = -ETIMEDOUT; + else { + /* Aborted by signal */ + rc = -EINTR; + ctx_refresh_interrupt(req); + } /* * following cases could lead us here: |