diff options
| author | Trond Myklebust <[email protected]> | 2022-10-05 19:57:36 +0000 |
|---|---|---|
| committer | Anna Schumaker <[email protected]> | 2022-10-06 13:52:09 +0000 |
| commit | f8423909ecca208834a9d704e58409800f8b5f21 (patch) | |
| tree | a55dc54d7ad0254bcab9d25240cc64b249483e61 /net/sunrpc/sched.c | |
| parent | SUNRPC: Fix races with rpc_killall_tasks() (diff) | |
| download | kernel-f8423909ecca208834a9d704e58409800f8b5f21.tar.gz kernel-f8423909ecca208834a9d704e58409800f8b5f21.zip | |
SUNRPC: Add a helper to allow pNFS drivers to selectively cancel RPC calls
Add the helper rpc_cancel_tasks(), which uses a caller-defined selection
function to define a set of in-flight RPC calls to cancel. This is
mainly intended for pNFS drivers which are subject to a layout recall,
and which may therefore want to cancel all pending I/O using that layout
in order to redrive it after the layout recall has been satisfied.
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
Diffstat (limited to 'net/sunrpc/sched.c')
| -rw-r--r-- | net/sunrpc/sched.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index f388bfaf6ff0..de912e02371b 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -872,6 +872,17 @@ void rpc_signal_task(struct rpc_task *task) rpc_wake_up_queued_task(queue, task); } +void rpc_task_try_cancel(struct rpc_task *task, int error) +{ + struct rpc_wait_queue *queue; + + if (!rpc_task_set_rpc_status(task, error)) + return; + queue = READ_ONCE(task->tk_waitqueue); + if (queue) + rpc_wake_up_queued_task(queue, task); +} + void rpc_exit(struct rpc_task *task, int status) { task->tk_status = status; |
