From: dai.ngo@oracle.com
To: Jeff Layton <jlayton@kernel.org>, chuck.lever@oracle.com
Cc: linux-nfs@vger.kernel.org, 張智諺 <cc85nod@gmail.com>
Subject: Re: [PATCH] nfsd: fix courtesy client with deny mode handling in nfs4_upgrade_open
Date: Wed, 15 Feb 2023 15:05:09 -0800 [thread overview]
Message-ID: <dab0d056-d2c8-a594-2a8f-c8dc2cefaa14@oracle.com> (raw)
In-Reply-To: <20230203181834.58634-1-jlayton@kernel.org>
Hi Jeff, Chuck,
On 2/3/23 10:18 AM, Jeff Layton wrote:
> The nested if statements here make no sense, as you can never reach
> "else" branch in the nested statement. Fix the error handling for
> when there is a courtesy client that holds a conflicting deny mode.
>
> Fixes: 3d69427151806 (NFSD: add support for share reservation conflict to courteous server)
> Reported-by: 張智諺 <cc85nod@gmail.com>
> Cc: Dai Ngo <dai.ngo@oracle.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/nfsd/nfs4state.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index c39e43742dd6..af22dfdc6fcc 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -5282,16 +5282,17 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp,
> /* test and set deny mode */
> spin_lock(&fp->fi_lock);
> status = nfs4_file_check_deny(fp, open->op_share_deny);
> - if (status == nfs_ok) {
> - if (status != nfserr_share_denied) {
> - set_deny(open->op_share_deny, stp);
> - fp->fi_share_deny |=
> - (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
> - } else {
> - if (nfs4_resolve_deny_conflicts_locked(fp, false,
> - stp, open->op_share_deny, false))
> - status = nfserr_jukebox;
> - }
> + switch (status) {
> + case nfs_ok:
> + set_deny(open->op_share_deny, stp);
> + fp->fi_share_deny |=
> + (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
> + break;
> + case nfserr_share_denied:
> + if (nfs4_resolve_deny_conflicts_locked(fp, false,
> + stp, open->op_share_deny, false))
While trying to write a pynfs test case to exercise this code path,
I realize that we don't need to call nfs4_resolve_deny_conflicts_locked
here since this is an open upgrade so it must comes from the same client
hence there is no conflict to resolve. Same behavior as OPEN_DOWNGRADE.
-Dai
> + status = nfserr_jukebox;
> + break;
> }
> spin_unlock(&fp->fi_lock);
>
next prev parent reply other threads:[~2023-02-15 23:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 18:18 [PATCH] nfsd: fix courtesy client with deny mode handling in nfs4_upgrade_open Jeff Layton
2023-02-04 15:49 ` Chuck Lever III
2023-02-04 20:50 ` dai.ngo
2023-02-05 17:06 ` Chuck Lever III
2023-02-15 23:05 ` dai.ngo [this message]
2023-02-16 7:24 ` dai.ngo
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=dab0d056-d2c8-a594-2a8f-c8dc2cefaa14@oracle.com \
--to=dai.ngo@oracle.com \
--cc=cc85nod@gmail.com \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--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