Commit dcd779dc authored by Jeff Layton's avatar Jeff Layton Committed by Chuck Lever

nfsd: fix courtesy client with deny mode handling in nfs4_upgrade_open

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: 3d694271 ("NFSD: add support for share reservation conflict to courteous server")
Reported-by: default avatar張智諺 <cc85nod@gmail.com>
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatarDai Ngo <dai.ngo@oracle.com>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 81e72297
...@@ -5282,16 +5282,17 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, ...@@ -5282,16 +5282,17 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp,
/* test and set deny mode */ /* test and set deny mode */
spin_lock(&fp->fi_lock); spin_lock(&fp->fi_lock);
status = nfs4_file_check_deny(fp, open->op_share_deny); status = nfs4_file_check_deny(fp, open->op_share_deny);
if (status == nfs_ok) { switch (status) {
if (status != nfserr_share_denied) { case nfs_ok:
set_deny(open->op_share_deny, stp); set_deny(open->op_share_deny, stp);
fp->fi_share_deny |= fp->fi_share_deny |=
(open->op_share_deny & NFS4_SHARE_DENY_BOTH); (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
} else { break;
if (nfs4_resolve_deny_conflicts_locked(fp, false, case nfserr_share_denied:
stp, open->op_share_deny, false)) if (nfs4_resolve_deny_conflicts_locked(fp, false,
status = nfserr_jukebox; stp, open->op_share_deny, false))
} status = nfserr_jukebox;
break;
} }
spin_unlock(&fp->fi_lock); spin_unlock(&fp->fi_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment