Date: Tue, 11 Jul 2017 14:47:02 -0700 From: John Baldwin <jhb@freebsd.org> To: Ian Lepore <ian@freebsd.org> Cc: Edward Tomasz Napierala <trasz@freebsd.org>, rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320803 - head/sbin/mount Message-ID: <5242112.0aHCQARnit@ralph.baldwin.cx> In-Reply-To: <1499805315.45330.14.camel@freebsd.org> References: <20170708171641.GA1129@brick> <20170711201230.GB1725@brick> <1499805315.45330.14.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, July 11, 2017 02:35:15 PM Ian Lepore wrote: > I think the docs on this are pretty clear... under -u it says: > > The set of options is determined by applying the options specified > in the argument to -o and finally applying the -r or -w option. > > To me, that says that nothing in /etc/fstab is germane to mount -u > unless one of the other args to mount -u is -o fstab. > > This change (r320803) seems like an acceptable workaround, but I think > the correct long term fix would be to not even open /etc/fstab on mount > -u without -o fstab. But that may be harder to do than to say; I still > haven't actually looked at the code involved. I concur with this. I've always viewed '-u' as meaning "apply a delta to the current configuration", not "add this delta to the fstab options and then apply that entire set of options". In practice, it seems that it doesn't do either of those, but instead it seems to treats the options passed to -o as the entire list of options. This is perhaps a bit surprising. For example, suppose you had this: /etc/fstab: /dev/md0 /bar ufs ro,noauto,noexec 0 0 # mount /bar # mount | grep bar /dev/md0 on /bar (ufs, local, noexec, read-only) # mount -u -o rw /bar /dev/md0 on /bar (ufs, local) (We just lost "noexec" from fstab by upgrading to read-write) # mount -u -o nosuid /bar # mount | grep bar /dev/md0 on /bar (ufs, local, nosuid) (Did not lose "read-write" somehow, RO vs RW must be magically sticky?) # mount -u -o fstab,nosuid /bar # mount |grep bar /dev/md0 on /bar (ufs, local, noexec, nosuid) (Did not honor "ro" from fstab! Left mount RW) It would seem that there is no actual rhyme or reason to how mount -u works, and certainly Edward's change doesn't make it worse. I would like to have some kind of mode where you can toggle one or more options without disturbing others. Maybe if we had a new "special" option called "current" or some such that is like "fstab" but instead represents the options currently in force, then you could do true delta operations via 'mount -o current,rw -u /foo'. As it is, there doesn't currently seem to a reliable way to achieve that functionality. (I started this mail expecting that '-u' operated by performing deltas against the current configuration and was quite Astonished to discover the actual behavior. It seems very unsafe to use mount -u if you have any options in your fstab outside of things like "noauto" or "late".) -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5242112.0aHCQARnit>