diff mbox series

[v3,1/3] nfsd: ignore requests to disable unsupported versions

Message ID 20221018114756.23679-1-jlayton@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v3,1/3] nfsd: ignore requests to disable unsupported versions | expand

Commit Message

Jeff Layton Oct. 18, 2022, 11:47 a.m. UTC
The kernel currently errors out if you attempt to enable or disable a
version that it doesn't recognize. Change it to ignore attempts to
disable an unrecognized version. If we don't support it, then there is
no harm in doing so.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfsd/nfsctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Tom Talpey Oct. 19, 2022, 2:58 p.m. UTC | #1
Stylistically, I think this needs a "break;", but otherwise

Reviewed-by: Tom Talpey <tom@talpey.com>

On 10/18/2022 7:47 AM, Jeff Layton wrote:
> The kernel currently errors out if you attempt to enable or disable a
> version that it doesn't recognize. Change it to ignore attempts to
> disable an unrecognized version. If we don't support it, then there is
> no harm in doing so.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>   fs/nfsd/nfsctl.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index dc74a947a440..68ed42fd29fc 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -601,7 +601,9 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
>   				}
>   				break;
>   			default:
> -				return -EINVAL;
> +				/* Ignore requests to disable non-existent versions */
> +				if (cmd == NFSD_SET)
> +					return -EINVAL;
>   			}
>   			vers += len + 1;
>   		} while ((len = qword_get(&mesg, vers, size)) > 0);
diff mbox series

Patch

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index dc74a947a440..68ed42fd29fc 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -601,7 +601,9 @@  static ssize_t __write_versions(struct file *file, char *buf, size_t size)
 				}
 				break;
 			default:
-				return -EINVAL;
+				/* Ignore requests to disable non-existent versions */
+				if (cmd == NFSD_SET)
+					return -EINVAL;
 			}
 			vers += len + 1;
 		} while ((len = qword_get(&mesg, vers, size)) > 0);