Date: Sun, 23 Jan 2011 10:45:22 +0100 From: Aurelien Jarno <aurelien@aurel32.net> To: Jaakko Heinonen <jh@FreeBSD.org> Cc: rodrigc@FreeBSD.org, freebsd-hackers@FreeBSD.org Subject: Re: [patch] nmount ro, rw and negated option handling Message-ID: <20110123094522.GA32156@ohm.aurel32.net> In-Reply-To: <20110114122454.GA4805@jh> References: <20110114122454.GA4805@jh>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 14, 2011 at 02:24:54PM +0200, Jaakko Heinonen wrote: > > Hi, Hi, > Currently nmount(2) allows a mount point to have "ro", "rw", and "noro" > string options concurrently active. This can cause erratic behavior > demonstrated by this example: > > 1. Have mountd(8) running. > 2. # mdconfig -a -t vnode -f ufsimg > 3. # mount -o ro,rw /dev/md0 /mnt > > After these steps the mount point has string options "ro", "rw" and > "noro" active but the MNT_RDONLY flag is not set. Eventually this will > lead to "ffs_sync: rofs mod" (or similar) panic because the ffs code > marks the file system read-only due to the "ro" string option. > (MNT_RDONLY flag is used in most places for read-only check.) > > I wrote a patch to do following changes: > > - vfs_equalopts() now recognizes "ro" and "rw" as equal options > - vfs_mergeopts() uses vfs_sanitizeopts() to merge options. This ensures > that if the same option shows up several times (negated or not), only > the last one is taken in account. There is still a problem when for > example option "foo" and "nofoo" are merged: the "nofoo" option will > become an active option. This is not a regression however and > currently I don't know an easy way to solve this because the list of > valid options is not available in vfs_mergeopts(). > - vfs_donmount() always converts "norw"/"rdonly" to "ro" and "noro" to > "rw". Thus the mount point will always have either "rw" or "ro" > option. I haven't seen any in-tree file system to test for "noro" but > at least ZFS tests for "rw". That's why I chose "rw" instead or > "noro". > > The patch is available here: > > http://people.freebsd.org/~jh/patches/nmount-ro-rw.diff > > Reviews and testing would be appreciated. > Thanks for the patch, I confirm it fixes the issue I reported in kern/150206. Aurelien -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110123094522.GA32156>