Bug 222078

Summary: Only the last option of "zfs mount -o" is honored
Product: Base System Reporter: Alan Somers <asomers>
Component: kernAssignee: Alan Somers <asomers>
Status: Closed FIXED    
Severity: Affects Many People CC: avg
Priority: --- Flags: asomers: mfc-stable11+
asomers: mfc-stable10+
Version: CURRENT   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 221985    

Description Alan Somers freebsd_committer freebsd_triage 2017-09-05 18:26:06 UTC
The "-o" option to "zfs mount" can be used to pass a list of options to nmount(2), like this: "zfs mount -o <opt>,<opt>,...,<opt>".  However, only the last option actually gets sent:

# zfs mount -o nosuid,noatime foo/fs
# mount | grep foo.fs
foo/fs on /foo/fs (zfs, local, noatime, nfsv4acls)
# zfs unmount foo/fs
# zfs mount -o noatime,nosuid foo/fs
# mount | grep foo.fs
foo/fs on /foo/fs (zfs, local, nosuid, nfsv4acls)

Notice how in the first case, only "noatime" was set, and in the second case, only "nosuid" was set.  Both options should've been set both times.
Comment 1 commit-hook freebsd_committer freebsd_triage 2017-09-05 19:28:53 UTC
A commit references this bug:

Author: asomers
Date: Tue Sep  5 19:28:36 UTC 2017
New revision: 323193
URL: https://svnweb.freebsd.org/changeset/base/323193

Log:
  Honor all options of "zfs mount -o"

  The existing code in zmount incorrectly parses the comma-delimited option
  string. The result is that nmount only honors the last option. AFAICT the
  parsing has been broken ever since ZFS's initial import in change 168404.

  PR:		222078
  Reviewed by:	avg
  MFC after:	3 weeks
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D12232

Changes:
  head/cddl/compat/opensolaris/misc/zmount.c
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-09-27 15:07:11 UTC
A commit references this bug:

Author: asomers
Date: Wed Sep 27 15:06:46 UTC 2017
New revision: 324061
URL: https://svnweb.freebsd.org/changeset/base/324061

Log:
  MFC r323193:

  Honor all options of "zfs mount -o"

  The existing code in zmount incorrectly parses the comma-delimited option
  string. The result is that nmount only honors the last option. AFAICT the
  parsing has been broken ever since ZFS's initial import in change 168404.

  PR:		222078
  Reviewed by:	avg
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D12232

Changes:
_U  stable/11/
  stable/11/cddl/compat/opensolaris/misc/zmount.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-11-28 17:30:35 UTC
A commit references this bug:

Author: asomers
Date: Tue Nov 28 17:30:26 UTC 2017
New revision: 326327
URL: https://svnweb.freebsd.org/changeset/base/326327

Log:
  MFC r323193:

  Honor all options of "zfs mount -o"

  The existing code in zmount incorrectly parses the comma-delimited option
  string. The result is that nmount only honors the last option. AFAICT the
  parsing has been broken ever since ZFS's initial import in change 168404.

  PR:		222078
  Reviewed by:	avg
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D12232

Changes:
_U  stable/10/
  stable/10/cddl/compat/opensolaris/misc/zmount.c