From: Jeff Layton <jlayton@kernel.org>
To: cel@kernel.org, Neil Brown <neilb@suse.de>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: [PATCH v3 2/8] NFSD: Fix nfsd4_shutdown_copy()
Date: Fri, 01 Nov 2024 08:28:42 -0400 [thread overview]
Message-ID: <f22222244fef5f0b110f6a229aad15e51a6155c5.camel@kernel.org> (raw)
In-Reply-To: <20241031134000.53396-12-cel@kernel.org>
On Thu, 2024-10-31 at 09:40 -0400, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
>
> nfsd4_shutdown_copy() is just this:
>
> while ((copy = nfsd4_get_copy(clp)) != NULL)
> nfsd4_stop_copy(copy);
>
> nfsd4_get_copy() bumps @copy's reference count, preventing
> nfsd4_stop_copy() from releasing @copy.
>
> A while loop like this usually works by removing the first element
> of the list, but neither nfsd4_get_copy() nor nfsd4_stop_copy()
> alters the async_copies list.
>
> Best I can tell, then, is that nfsd4_shutdown_copy() continues to
> loop until other threads manage to remove all the items from this
> list. The spinning loop blocks shutdown until these items are gone.
>
> Possibly the reason we haven't seen this issue in the field is
> because client_has_state() prevents __destroy_client() from calling
> nfsd4_shutdown_copy() if there are any items on this list. In a
> subsequent patch I plan to remove that restriction.
>
> Fixes: e0639dc5805a ("NFSD introduce async copy feature")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> fs/nfsd/nfs4proc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 9f6617fa5412..8229bbfdd735 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1302,6 +1302,9 @@ static struct nfsd4_copy *nfsd4_get_copy(struct nfs4_client *clp)
> copy = list_first_entry(&clp->async_copies, struct nfsd4_copy,
> copies);
> refcount_inc(©->refcount);
> + copy->cp_clp = NULL;
> + if (!list_empty(©->copies))
> + list_del_init(©->copies);
> }
> spin_unlock(&clp->async_lock);
> return copy;
My initial thought was:
The problem sounds real, but is nfsd4_get_copy() the place for the
above logic?
But then I noticed that nfsd4_get_copy() is only called from
nfsd4_shutdown_copy(). Maybe we should be rename nfsd4_get_copy() to
nfsd4_find_and_unhash_copy() ?
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-11-01 12:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 13:40 [PATCH v3 0/8] async COPY fixes for NFSD cel
2024-10-31 13:40 ` [PATCH v3 1/8] NFSD: Add a tracepoint to record canceled async COPY operations cel
2024-10-31 13:40 ` [PATCH v3 2/8] NFSD: Fix nfsd4_shutdown_copy() cel
2024-11-01 12:28 ` Jeff Layton [this message]
2024-11-01 13:04 ` Chuck Lever
2024-10-31 13:40 ` [PATCH v3 3/8] NFSD: Free async copy information in nfsd4_cb_offload_release() cel
2024-10-31 13:40 ` [PATCH v3 4/8] NFSD: Handle an NFS4ERR_DELAY response to CB_OFFLOAD cel
2024-11-01 12:41 ` Jeff Layton
2024-11-01 13:03 ` Chuck Lever
2024-10-31 13:40 ` [PATCH v3 5/8] NFSD: Block DESTROY_CLIENTID only when there are ongoing async COPY operations cel
2024-10-31 13:40 ` [PATCH v3 6/8] NFSD: Add a laundromat reaper for async copy state cel
2024-10-31 13:40 ` [PATCH v3 7/8] NFSD: Add nfsd4_copy time-to-live cel
2024-10-31 13:40 ` [PATCH v3 8/8] NFSD: Send CB_OFFLOAD on graceful shutdown cel
2024-11-01 13:05 ` Jeff Layton
2024-11-01 13:18 ` Chuck Lever
2024-11-01 13:30 ` Jeff Layton
2024-11-01 14:00 ` Chuck Lever
2024-11-01 13:06 ` [PATCH v3 0/8] async COPY fixes for NFSD Jeff Layton
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=f22222244fef5f0b110f6a229aad15e51a6155c5.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
/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