Re: [PATCH] NFSD: fix deny mode logic in nfs4_upgrade_open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Feb 2, 2023, at 2:36 AM, Pumpkin <cc85nod@xxxxxxxxx> wrote:
> 
> If the upgrading deny mode is invalid or conflicts with other client, we
> should try to resolve it, but the if-condition makes those error handling
> cannot be executed.
> 
> Signed-off-by: Pumpkin <cc85nod@xxxxxxxxx>
> ---
> fs/nfsd/nfs4state.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 4ef529379..ebdfaf0f9 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -5298,7 +5298,7 @@ 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 != nfs_ok) {
> 		if (status != nfserr_share_denied) {

if status == nfs_ok then status will definitely not equal
share_denied. So this check is a bit nonsensical as it stands.

Usually I prefer "switch (status)" in situations like this
because that avoids this kind of issue and I find it easier
to read quickly.

Jeff, you are the original author of this function, and
Dai, your commit is the last one to touch this area. Can
you guys have a look? The one-liner looks correct, but I
might be missing something.


> 			set_deny(open->op_share_deny, stp);
> 			fp->fi_share_deny |=
> -- 
> 2.37.1 (Apple Git-137.1)
> 

--
Chuck Lever







[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux