diff mbox

NFS: correctly report misuse of "migration" mount option.

Message ID 20131114130017.374c0f3d@notabene.brown (mailing list archive)
State New, archived
Headers show

Commit Message

NeilBrown Nov. 14, 2013, 2 a.m. UTC
The current test on valid use of the "migration" mount option can never
report an error as it will only do so if
    mnt->version !=4 && mnt->minor_version != 0
(and some other condition), but if that test would succeed, then the previous
test has already gone-to  out_minorversion_mismatch.

So change the && to an || to get correct semantics.

Signed-off-by: NeilBrown <neilb@suse.de>

Comments

Chuck Lever Nov. 14, 2013, 4:31 p.m. UTC | #1
On Nov 13, 2013, at 9:00 PM, NeilBrown <neilb@suse.de> wrote:

> 
> The current test on valid use of the "migration" mount option can never
> report an error as it will only do so if
>    mnt->version !=4 && mnt->minor_version != 0
> (and some other condition), but if that test would succeed, then the previous
> test has already gone-to  out_minorversion_mismatch.
> 
> So change the && to an || to get correct semantics.
> 
> Signed-off-by: NeilBrown <neilb@suse.de>

Acked-by: Chuck Lever <chuck.lever@oracle.com>

> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> index 317d6fc2160e..910ed906eb82 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -1613,9 +1613,9 @@ static int nfs_parse_mount_options(char *raw,
> 	if (mnt->minorversion && mnt->version != 4)
> 		goto out_minorversion_mismatch;
> 
> 	if (mnt->options & NFS_OPTION_MIGRATION &&
> -	    mnt->version != 4 && mnt->minorversion != 0)
> +	    (mnt->version != 4 || mnt->minorversion != 0))
> 		goto out_migration_misuse;
> 
> 	/*
> 	 * verify that any proto=/mountproto= options match the address
diff mbox

Patch

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 317d6fc2160e..910ed906eb82 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1613,9 +1613,9 @@  static int nfs_parse_mount_options(char *raw,
 	if (mnt->minorversion && mnt->version != 4)
 		goto out_minorversion_mismatch;
 
 	if (mnt->options & NFS_OPTION_MIGRATION &&
-	    mnt->version != 4 && mnt->minorversion != 0)
+	    (mnt->version != 4 || mnt->minorversion != 0))
 		goto out_migration_misuse;
 
 	/*
 	 * verify that any proto=/mountproto= options match the address