[PATCH 1/1] mount.nfs: mounts fail when invalid versions are specified

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

 



When mount options like -o nfsvers=5 or -o v5 call the mount
to silently fail. This patch adds verbosity to those types
of failures.

Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
---
 utils/mount/network.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index e7bd522..e125c11 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1235,6 +1235,10 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
 	long tmp;
 
 	switch (po_rightmost(options, nfs_version_opttbl)) {
+	case -1: /* invalid value */
+		nfs_error(_("%s: invalid mount option was specified"),
+					progname);
+		return 0;
 	case 0:	/* v2 */
 		*version = 2;
 		return 1;
@@ -1251,6 +1255,8 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
 				*version = tmp;
 				return 1;
 			}
+			nfs_error(_("%s: invalid value for 'vers=' option"),
+					progname);
 			return 0;
 		case PO_NOT_FOUND:
 			nfs_error(_("%s: parsing error on 'vers=' option\n"),
@@ -1268,6 +1274,8 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
 				*version = tmp;
 				return 1;
 			}
+			nfs_error(_("%s: invalid value for 'nfsvers=' option"),
+					progname);
 			return 0;
 		case PO_NOT_FOUND:
 			nfs_error(_("%s: parsing error on 'nfsvers=' option\n"),
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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