From owner-freebsd-bugs@FreeBSD.ORG Mon Oct 15 06:18:20 2007 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B229716A418 for ; Mon, 15 Oct 2007 06:18:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 4CDD013C45A for ; Mon, 15 Oct 2007 06:18:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c220-239-235-248.carlnfd3.nsw.optusnet.com.au [220.239.235.248]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id l9F6IEoU006266 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 15 Oct 2007 16:18:18 +1000 Date: Mon, 15 Oct 2007 16:18:14 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eugene Grosbein In-Reply-To: <200710141450.l9EEo4eI008836@freefall.freebsd.org> Message-ID: <20071015154453.Y1164@besplex.bde.org> References: <200710141450.l9EEo4eI008836@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-bugs@freebsd.org Subject: Re: kern/116608: [panic] [patch] [msdosfs] msdosfs fails to check mount options X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2007 06:18:20 -0000 On Sun, 14 Oct 2007, Eugene Grosbein wrote: > Subject: Re: kern/116608: [panic] [patch] [msdosfs] msdosfs fails to check mount options > > Here is a version of last patch adjusted for 7.0-PRERELEASE: Is the bug in -current just that "mount -o rw" doesn't give rw when fstab says ro? ffs seems to have the same bug -- rw just doesn't work. noro works. This may be affected by my mount utilities being out of date (~5.2 mount, ~5.2 mount_ffs, old -current mount_msdosfs -- so old or broken that it can't handle noauto in fstab). Starting with a file system mounted ro, "mount -u -o fstab,rw" and "mount -u -o current,rw" show the same bug (noro works). Even "mount -u" and "mount -u -o rw" don't work (noro works) for msdosfs, but work for ffs. This might be because my mount_msdosfs is old enough to be missing fixes and my mount_ffs is old enough to be missing bugs (it doesn't use nmount(), whose existence is the cause of most of these bugs). Upgrading to the ~5.2 mount_msdosfs fixes the bugs for -u but not for initial mounts. (I downgraded to the old -current mount_msdosfs to test what it does. This works because at least the compatibility cruft parts of nmount() work OK.) > --- sys/fs/msdosfs/msdosfs_vfsops.c.orig 2007-08-16 01:40:09.000000000 +0800 > +++ sys/fs/msdosfs/msdosfs_vfsops.c 2007-10-14 17:58:20.000000000 +0800 > @@ -265,6 +265,7 @@ > } > } > if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) && > + !vfs_flagopt(mp->mnt_optnew, "noro", NULL, 0) && > vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { > error = VFS_SYNC(mp, MNT_WAIT, td); > if (error) > @@ -314,10 +315,12 @@ > > ro_to_rw = 1; > } > + if(!vfs_flagopt(mp->mnt_optnew, "noro", NULL, 0)) { > vfs_flagopt(mp->mnt_optnew, "ro", > &pmp->pm_flags, MSDOSFSMNT_RONLY); > vfs_flagopt(mp->mnt_optnew, "ro", > &mp->mnt_flag, MNT_RDONLY); > + } > > if (ro_to_rw) { > /* Now that the volume is modifiable, mark it dirty. */ I think the patch belongs at a higher level. Individual file systems already have a lot of bloat to parse options. Where mount(1) had centralized table-driven option parsing for at least generic options, ffs has a 4-line if statement for each supported option, and msdosfs apparently has missing code -- why does ffs need more than a table to indicate its support for the atime option, and how does atime work in msdosfs where this support is missing; why does ffs have mounds of code to parse both async and noasync, and if this is needed than why isn't it needed for almost all options? Bruce