linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@redhat.com>
To: Olga Kornievskaia <kolga@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH v4 10/10] NFSD stop queued async copies on client shutdown
Date: Thu, 28 Sep 2017 15:21:49 -0400	[thread overview]
Message-ID: <20170928192148.GM10182@parsley.fieldses.org> (raw)
In-Reply-To: <20170928172945.50780-11-kolga@netapp.com>

On Thu, Sep 28, 2017 at 01:29:45PM -0400, Olga Kornievskaia wrote:
> If client is shutting down and there are still async copies going
> on, then stop queued async copies.
> 
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> ---
>  fs/nfsd/nfs4proc.c  | 9 +++++++++
>  fs/nfsd/nfs4state.c | 1 +
>  fs/nfsd/state.h     | 2 ++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 74bfa4b..8d0c87f 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -91,6 +91,12 @@ void nfsd4_destroy_copy_queue(void)
>  	destroy_workqueue(copy_wq);
>  }
>  
> +void nfsd4_shutdown_copy(struct nfs4_client *clp)
> +{
> +	set_bit(NFSD4_CLIENT_COPY_KILL, &clp->cl_flags);
> +	flush_workqueue(copy_wq);

Looks like that will just stop new copies and wait on any ongoing ones.
That could be a long wait.

A signal should help there too.

If you still need a "this client is dying" bit in cl_flags, you could
probably just use CB_KILL instead of this new one.

--b.

> +}
> +
>  #define NFSDDBG_FACILITY		NFSDDBG_PROC
>  
>  static u32 nfsd_attrmask[] = {
> @@ -1205,6 +1211,9 @@ static void nfsd4_do_async_copy(struct work_struct *work)
>  		container_of(work, struct nfsd4_copy, cp_work);
>  	struct nfsd4_copy *cb_copy;
>  
> +	if (test_bit(NFSD4_CLIENT_COPY_KILL, &copy->cp_clp->cl_flags))
> +		goto out;
> +
>  	copy->nfserr = nfsd4_do_copy(copy, 0);
>  
>  	if (copy->cps->cp_cancelled)
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 97ab3f8..f4b193e 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1961,6 +1961,7 @@ static __be32 mark_client_expired_locked(struct nfs4_client *clp)
>  	}
>  	nfsd4_return_all_client_layouts(clp);
>  	nfsd4_shutdown_callback(clp);
> +	nfsd4_shutdown_copy(clp);
>  	if (clp->cl_cb_conn.cb_xprt)
>  		svc_xprt_put(clp->cl_cb_conn.cb_xprt);
>  	free_client(clp);
> diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
> index c31025c..55f09a9 100644
> --- a/fs/nfsd/state.h
> +++ b/fs/nfsd/state.h
> @@ -336,6 +336,7 @@ struct nfs4_client {
>  #define NFSD4_CLIENT_RECLAIM_COMPLETE	(3)	/* reclaim_complete done */
>  #define NFSD4_CLIENT_CONFIRMED		(4)	/* client is confirmed */
>  #define NFSD4_CLIENT_UPCALL_LOCK	(5)	/* upcall serialization */
> +#define NFSD4_CLIENT_COPY_KILL		(6)	/* stop copy workqueue */
>  #define NFSD4_CLIENT_CB_FLAG_MASK	(1 << NFSD4_CLIENT_CB_UPDATE | \
>  					 1 << NFSD4_CLIENT_CB_KILL)
>  	unsigned long		cl_flags;
> @@ -644,6 +645,7 @@ extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
>  extern int nfsd4_create_callback_queue(void);
>  extern void nfsd4_destroy_callback_queue(void);
>  extern void nfsd4_shutdown_callback(struct nfs4_client *);
> +extern void nfsd4_shutdown_copy(struct nfs4_client *clp);
>  extern void nfsd4_prepare_cb_recall(struct nfs4_delegation *dp);
>  extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(const char *name,
>  							struct nfsd_net *nn);
> -- 
> 1.8.3.1
> 

      reply	other threads:[~2017-09-28 19:21 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 17:29 [PATCH v4 00/10] NFSD support for asynchronous COPY Olga Kornievskaia
2017-09-28 17:29 ` [PATCH v4 01/10] NFSD CB_OFFLOAD xdr Olga Kornievskaia
2017-09-28 17:29 ` [PATCH v4 02/10] NFSD OFFLOAD_STATUS xdr Olga Kornievskaia
2017-09-28 19:34   ` J. Bruce Fields
2017-09-28 17:29 ` [PATCH v4 03/10] NFSD OFFLOAD_CANCEL xdr Olga Kornievskaia
2017-09-28 19:34   ` J. Bruce Fields
2017-09-28 19:40     ` Olga Kornievskaia
2017-09-28 19:44       ` J. Bruce Fields
2017-09-28 17:29 ` [PATCH v4 04/10] NFSD xdr callback stateid in async COPY reply Olga Kornievskaia
2017-09-28 17:29 ` [PATCH v4 05/10] NFSD first draft of async copy Olga Kornievskaia
2017-09-28 18:07   ` J. Bruce Fields
2017-09-28 18:44     ` Olga Kornievskaia
2017-09-28 18:55       ` J. Bruce Fields
     [not found]         ` <805B49AE-1DB0-4FB1-BEEB-84A7740E9B09@netapp.com>
2017-09-28 19:07           ` J. Bruce Fields
2017-09-28 19:11             ` Olga Kornievskaia
2017-09-29 21:51     ` Olga Kornievskaia
2017-10-02 16:10       ` J. Bruce Fields
2017-09-28 18:16   ` J. Bruce Fields
2017-09-28 17:29 ` [PATCH v4 06/10] NFSD return nfs4_stid in nfs4_preprocess_stateid_op Olga Kornievskaia
2017-09-28 17:29 ` [PATCH v4 07/10] NFSD create new stateid for async copy Olga Kornievskaia
2017-09-28 19:12   ` J. Bruce Fields
2017-09-28 19:21     ` Olga Kornievskaia
2017-09-28 19:24       ` J. Bruce Fields
2017-09-28 17:29 ` [PATCH v4 08/10] NFSD handle OFFLOAD_CANCEL op Olga Kornievskaia
2017-09-28 18:38   ` J. Bruce Fields
2017-10-09 14:53     ` Olga Kornievskaia
2017-10-09 15:58       ` J. Bruce Fields
2017-10-10 21:14         ` Olga Kornievskaia
2017-10-11 14:07           ` J. Bruce Fields
2017-10-11 15:02             ` Olga Kornievskaia
2017-10-11 15:19               ` J. Bruce Fields
2017-10-11 16:08                 ` Olga Kornievskaia
2017-10-12 10:56                   ` Jeff Layton
2017-09-28 17:29 ` [PATCH v4 09/10] NFSD support OFFLOAD_STATUS Olga Kornievskaia
2017-09-28 17:29 ` [PATCH v4 10/10] NFSD stop queued async copies on client shutdown Olga Kornievskaia
2017-09-28 19:21   ` J. Bruce Fields [this message]

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=20170928192148.GM10182@parsley.fieldses.org \
    --to=bfields@redhat.com \
    --cc=kolga@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /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).