From: NeilBrown <neilb@suse.com>
To: Joshua Watt <jpewhacker@gmail.com>,
Jeff Layton <jlayton@redhat.com>,
Trond Myklebust <trond.myklebust@primarydata.com>,
"J . Bruce Fields" <bfields@fieldses.org>
Cc: linux-nfs@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
David Howells <dhowells@redhat.com>,
Joshua Watt <JPEWhacker@gmail.com>
Subject: Re: [RFC v4 1/9] SUNRPC: Add flag to kill new tasks
Date: Wed, 06 Dec 2017 09:59:45 +1100 [thread overview]
Message-ID: <87o9ncsrvi.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20171117174552.18722-2-JPEWhacker@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2848 bytes --]
On Fri, Nov 17 2017, Joshua Watt wrote:
> The flag causes any new tasks that are queued to exit immediately with
> -EIO instead of executing. This will allow clients (particularly NFS) to
> prevents these task from delaying shutdown of the RPC session longer
> than necessary.
>
> Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
> ---
> include/linux/sunrpc/clnt.h | 1 +
> net/sunrpc/clnt.c | 5 ++---
> net/sunrpc/sched.c | 3 +++
> 3 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
> index 71c237e8240e..d36dc529fdf0 100644
> --- a/include/linux/sunrpc/clnt.h
> +++ b/include/linux/sunrpc/clnt.h
> @@ -54,6 +54,7 @@ struct rpc_clnt {
> cl_noretranstimeo: 1,/* No retransmit timeouts */
> cl_autobind : 1,/* use getport() */
> cl_chatty : 1;/* be verbose */
> + atomic_t cl_kill_new_tasks; /* Kill all new tasks */
It looks a little weird that this is an atomic_t.
Looking further ahead, it seems that it is a counter of threads that
have request new tasks be killed.
It might help to make that clear, at least in a comment.
>
> struct rpc_rtt * cl_rtt; /* RTO estimator data */
> const struct rpc_timeout *cl_timeout; /* Timeout strategy */
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index df4ecb042ebe..d5eedabf0b4d 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -626,6 +626,8 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args,
> new->cl_noretranstimeo = clnt->cl_noretranstimeo;
> new->cl_discrtry = clnt->cl_discrtry;
> new->cl_chatty = clnt->cl_chatty;
> + atomic_set(&new->cl_kill_new_tasks,
> + atomic_read(&clnt->cl_kill_new_tasks));
However ... as it is a counter, it isn't clear that copying the counter
makes sense, and the new counter will never get decremented.
Maybe __rpc_clone_client() should fail if ->cl_kill_new_tasks > 0 ??
Thanks,
NeilBrown
> return new;
>
> out_err:
> @@ -818,9 +820,6 @@ void rpc_killall_tasks(struct rpc_clnt *clnt)
> {
> struct rpc_task *rovr;
>
> -
> - if (list_empty(&clnt->cl_tasks))
> - return;
> dprintk("RPC: killing all tasks for client %p\n", clnt);
> /*
> * Spin lock all_tasks to prevent changes...
> diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
> index 0cc83839c13c..e70034e19ccd 100644
> --- a/net/sunrpc/sched.c
> +++ b/net/sunrpc/sched.c
> @@ -748,6 +748,9 @@ static void __rpc_execute(struct rpc_task *task)
> dprintk("RPC: %5u __rpc_execute flags=0x%x\n",
> task->tk_pid, task->tk_flags);
>
> + if (atomic_read(&task->tk_client->cl_kill_new_tasks))
> + rpc_exit(task, -EIO);
> +
> WARN_ON_ONCE(RPC_IS_QUEUED(task));
> if (RPC_IS_QUEUED(task))
> return;
> --
> 2.13.6
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-12-05 22:59 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 17:45 [RFC v4 0/9] NFS Force Unmounting Joshua Watt
2017-11-17 17:45 ` [RFC v4 1/9] SUNRPC: Add flag to kill new tasks Joshua Watt
2017-12-05 22:59 ` NeilBrown [this message]
2017-11-17 17:45 ` [RFC v4 2/9] SUNRPC: Expose kill_new_tasks in debugfs Joshua Watt
2017-11-17 17:45 ` [RFC v4 3/9] SUNRPC: Simplify client shutdown Joshua Watt
2017-11-17 17:45 ` [RFC v4 4/9] namespace: Add umount_end superblock operation Joshua Watt
2017-12-06 11:54 ` Jeff Layton
2017-12-06 12:14 ` Al Viro
2017-12-06 12:33 ` Al Viro
2017-12-06 15:41 ` Joshua Watt
2017-11-17 17:45 ` [RFC v4 5/9] NFS: Kill RPCs for the duration of umount Joshua Watt
2017-12-05 23:07 ` NeilBrown
2017-11-17 17:45 ` [RFC v4 6/9] NFS: Add debugfs for nfs_server and nfs_client Joshua Watt
2017-11-17 17:45 ` [RFC v4 7/9] NFS: Add transient mount option Joshua Watt
2017-12-06 12:23 ` Jeff Layton
2017-11-17 17:45 ` [RFC v4 8/9] NFS: Don't shared transient clients Joshua Watt
2017-11-17 17:45 ` [RFC v4 9/9] NFS: Kill all client RPCs if transient Joshua Watt
2017-12-04 14:36 ` [RFC v4 0/9] NFS Force Unmounting Joshua Watt
2017-12-05 23:34 ` NeilBrown
2017-12-06 13:03 ` Jeff Layton
2017-12-06 16:40 ` Joshua Watt
2017-12-08 2:10 ` NeilBrown
2017-12-14 18:22 ` Joshua Watt
2017-12-14 21:52 ` NeilBrown
2017-12-18 21:48 ` Joshua Watt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o9ncsrvi.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=bfields@fieldses.org \
--cc=dhowells@redhat.com \
--cc=jlayton@redhat.com \
--cc=jpewhacker@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).