linux/fs/nfs
Chuck Lever f45663ce5f NFS: Allow either strict or sloppy mount option parsing
The kernel's NFS client mount option parser currently doesn't allow
unrecognized or incorrect mount options.  This prevents misspellings or
incorrectly specified mount options from possibly causing silent data
corruption.

However, NFS mount options are not standardized, so different operating
systems can use differently spelled mount options to support similar
features, or can support mount options which no other operating system
supports.

"Sloppy" mount option parsing, which allows the parser to ignore any
option it doesn't recognize, is needed to support automounters that often
use maps that are shared between heterogenous operating systems.

The legacy mount command ignores the validity of the values of mount
options entirely, except for the "sec=" and "proto=" options.  If an
incorrect value is specified, the out-of-range value is passed to the
kernel; if a value is specified that contains non-numeric characters,
it appears as though the legacy mount command sets that option to zero
(probably incorrect behavior in general).

In any case, this sets a precedent which we will partially follow for
the kernel mount option parser:

	+ if "sloppy" is not set, the parser will be strict about both
	  unrecognized options (same as legacy) and invalid option
	  values (stricter than legacy)

	+ if "sloppy" is set, the parser will ignore unrecognized
	  options and invalid option values (same as legacy)

An "invalid" option value in this case means that either the type
(integer, short, or string) or sign (for integer values) of the specified
value is incorrect.

This patch does two things: it changes the NFS client's mount option
parsing loop so that it parses the whole string instead of failing at
the first unrecognized option or invalid option value.  An unrecognized
option or an invalid option value cause the option to be skipped.

Then, the patch adds a "sloppy" mount option that allows the parsing
to succeed anyway if there were any problems during parsing.  When
parsing a set of options is complete, if there are errors and "sloppy"
was specified, return success anyway.  Otherwise, only return success
if there are no errors.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2008-07-09 12:09:44 -04:00
..
callback_proc.c nfs: replace remaining __FUNCTION__ occurrences 2008-05-16 09:43:29 -07:00
callback_xdr.c nfs: replace remaining __FUNCTION__ occurrences 2008-05-16 09:43:29 -07:00
callback.c nfs4: fix potential race with rapid nfs_callback_up/down cycle 2008-07-09 12:09:32 -04:00
callback.h NFS: Change cb_recallargs to pass "struct sockaddr *" instead of sockaddr_in 2008-01-30 02:05:55 -05:00
client.c NFS: set transport defaults after mount option parsing is finished 2008-07-09 12:09:38 -04:00
delegation.c nfs: replace remaining __FUNCTION__ occurrences 2008-05-16 09:43:29 -07:00
delegation.h NFS: Add an asynchronous delegreturn operation for use in nfs_clear_inode 2008-01-30 02:06:12 -05:00
dir.c NFS: Use NFSDBG_FILE for all fops 2008-07-09 12:09:04 -04:00
direct.c NFS: Use NFSDBG_FILE for all fops 2008-07-09 12:09:04 -04:00
file.c NFS: Remove the redundant file_open entry from struct nfs_rpc_ops 2008-07-09 12:09:16 -04:00
getroot.c Convert ERR_PTR(PTR_ERR(p)) instances to ERR_CAST(p) 2008-02-07 08:42:26 -08:00
idmap.c nfs: fix sparse warnings 2008-02-20 16:15:44 -05:00
inode.c NFS: Ensure we zap only the access and acl caches when setting new acls 2008-07-09 12:09:19 -04:00
internal.h NFS: Ensure we zap only the access and acl caches when setting new acls 2008-07-09 12:09:19 -04:00
iostat.h NFS: Fix a warning in nfs4_async_handle_error 2008-07-09 12:09:18 -04:00
Makefile NFS: Always enable NFS direct I/O 2008-03-19 18:00:34 -04:00
mount_clnt.c NFS: Fix filehandle size comparisons in the mount code 2008-06-23 17:09:06 -04:00
namespace.c nfs: path_{get,put}() cleanups 2008-05-16 09:43:30 -07:00
nfs2xdr.c nfs: return negative error value from nfs{,4}_stat_to_errno 2008-04-19 16:54:47 -04:00
nfs3acl.c NFS: Ensure we zap only the access and acl caches when setting new acls 2008-07-09 12:09:19 -04:00
nfs3proc.c NFS: Remove the redundant file_open entry from struct nfs_rpc_ops 2008-07-09 12:09:16 -04:00
nfs3xdr.c nfs: return negative error value from nfs{,4}_stat_to_errno 2008-04-19 16:54:47 -04:00
nfs4_fs.h nfs: make nfs4_drop_state_owner() static 2008-05-16 09:43:31 -07:00
nfs4namespace.c nfs: replace remaining __FUNCTION__ occurrences 2008-05-16 09:43:29 -07:00
nfs4proc.c nfs: initialize timeout variable in nfs4_proc_setclientid_confirm 2008-07-09 12:09:30 -04:00
nfs4renewd.c nfs: replace remaining __FUNCTION__ occurrences 2008-05-16 09:43:29 -07:00
nfs4state.c nfs: make nfs4_drop_state_owner() static 2008-05-16 09:43:31 -07:00
nfs4xdr.c nfs: replace remaining __FUNCTION__ occurrences 2008-05-16 09:43:29 -07:00
nfsroot.c NFS: use documenting macro constants for initializing ac{reg, dir}{min, max} 2008-07-09 12:09:40 -04:00
pagelist.c Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc 2008-02-01 11:45:47 +11:00
proc.c NFS: Remove the redundant file_open entry from struct nfs_rpc_ops 2008-07-09 12:09:16 -04:00
read.c nfs: replace remaining __FUNCTION__ occurrences 2008-05-16 09:43:29 -07:00
super.c NFS: Allow either strict or sloppy mount option parsing 2008-07-09 12:09:44 -04:00
symlink.c nfs: remove unnecessary NFS_NEED_* defines 2008-04-23 16:13:37 -04:00
sysctl.c [PATCH] nfs: fix congestion control 2007-03-16 19:25:05 -07:00
unlink.c SUNRPC: Add a helper rpcauth_lookup_generic_cred() 2008-03-14 13:42:49 -04:00
write.c NFS: Allow redirtying of a completed unstable write. 2008-07-09 12:09:24 -04:00