From: Jeff Layton <jlayton@kernel.org>
To: NeilBrown <neilb@suse.de>, Chuck Lever <chuck.lever@oracle.com>,
Olga Kornievskaia <okorniev@redhat.com>
Cc: Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfsd: fix delegation_blocked() to block correctly for at least 30 seconds
Date: Mon, 09 Sep 2024 08:24:51 -0400 [thread overview]
Message-ID: <adadfa97e30bc4d827df194814e4e05aa26b8266.camel@kernel.org> (raw)
In-Reply-To: <172585839640.4433.13337900639103448371@noble.neil.brown.name>
On Mon, 2024-09-09 at 15:06 +1000, NeilBrown wrote:
> The pair of bloom filtered used by delegation_blocked() was intended to
> block delegations on given filehandles for between 30 and 60 seconds. A
> new filehandle would be recorded in the "new" bit set. That would then
> be switch to the "old" bit set between 0 and 30 seconds later, and it
> would remain as the "old" bit set for 30 seconds.
>
Since we're on the subject...
60s seems like an awfully long time to block delegations on an inode.
Recalls generally don't take more than a few seconds when things are
functioning properly.
Should we swap the bloom filters more often?
> Unfortunately the code intended to clear the old bit set once it reached
> 30 seconds old, preparing it to be the next new bit set, instead cleared
> the *new* bit set before switching it to be the old bit set. This means
> that the "old" bit set is always empty and delegations are blocked
> between 0 and 30 seconds.
>
> This patch updates bd->new before clearing the set with that index,
> instead of afterwards.
>
> Reported-by: Olga Kornievskaia <okorniev@redhat.com>
> Cc: stable@vger.kernel.org
> Fixes: 6282cd565553 ("NFSD: Don't hand out delegations for 30 seconds after recalling them.")
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
> fs/nfsd/nfs4state.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 4313addbe756..6f18c1a7af2e 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1078,7 +1078,8 @@ static void nfs4_free_deleg(struct nfs4_stid *stid)
> * When a delegation is recalled, the filehandle is stored in the "new"
> * filter.
> * Every 30 seconds we swap the filters and clear the "new" one,
> - * unless both are empty of course.
> + * unless both are empty of course. This results in delegations for a
> + * given filehandle being blocked for between 30 and 60 seconds.
> *
> * Each filter is 256 bits. We hash the filehandle to 32bit and use the
> * low 3 bytes as hash-table indices.
> @@ -1107,9 +1108,9 @@ static int delegation_blocked(struct knfsd_fh *fh)
> if (ktime_get_seconds() - bd->swap_time > 30) {
> bd->entries -= bd->old_entries;
> bd->old_entries = bd->entries;
> + bd->new = 1-bd->new;
> memset(bd->set[bd->new], 0,
> sizeof(bd->set[0]));
> - bd->new = 1-bd->new;
> bd->swap_time = ktime_get_seconds();
> }
> spin_unlock(&blocked_delegations_lock);
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-09-09 12:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-09 5:06 [PATCH] nfsd: fix delegation_blocked() to block correctly for at least 30 seconds NeilBrown
2024-09-09 12:09 ` Benjamin Coddington
2024-09-09 12:10 ` Jeff Layton
2024-09-09 12:24 ` Jeff Layton [this message]
2024-09-09 14:17 ` Olga Kornievskaia
2024-09-09 14:28 ` Jeff Layton
2024-09-09 14:37 ` Chuck Lever
2024-09-09 15:02 ` Olga Kornievskaia
2024-09-09 15:14 ` Chuck Lever III
2024-09-10 12:32 ` Tom Talpey
2024-09-10 12:52 ` Jeff Layton
2024-09-10 13:28 ` Tom Talpey
2024-09-10 14:18 ` Chuck Lever III
2024-09-11 0:00 ` NeilBrown
2024-09-11 14:13 ` Olga Kornievskaia
2024-09-16 1:17 ` NeilBrown
2024-09-16 2:04 ` NeilBrown
2024-09-27 12:44 ` Benjamin Coddington
2024-09-09 14:45 ` cel
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=adadfa97e30bc4d827df194814e4e05aa26b8266.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@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