Skip to contentSkip to conversation

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

PATCH In review NeilBrown 2 participants 2 messages Nov 14, 2013

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 NFS: correctly report misuse of "migration" mount option.

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.

fs/nfs/super.c +1 -1
index 317d6fc2160e..910ed906eb82 100644
@@ -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
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · NeilBrown

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.

Quoted 15 lines
fs/nfs/super.c +1 -1
index 317d6fc2160e..910ed906eb82 100644
@@ -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
Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com