Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Sep 2009 04:00:32 +0000
From:      Craig Rodrigues <rodrigc@crodrigues.org>
To:        Jaakko Heinonen <jh@saunalahti.fi>
Cc:        Mel Flynn <mel.flynn+fbsd.current@mailing.thruhere.net>, freebsd-current@freebsd.org, Pawel Jakub Dawidek <pjd@freebsd.org>, Jeff Blank <jfb@mr-happy.com>
Subject:   Re: 8.0-BETA4 panic: ffs_sync: rofs mod
Message-ID:  <20090915040032.GA68823@crodrigues.org>
In-Reply-To: <20090914173208.GA4273@a91-153-125-115.elisa-laajakaista.fi>
References:  <20090908202553.GA1368@mr-happy.com> <200909090902.34055.mel.flynn%2Bfbsd.current@mailing.thruhere.net> <20090910091329.GA2726@a91-153-125-115.elisa-laajakaista.fi> <200909140302.03003.mel.flynn%2Bfbsd.current@mailing.thruhere.net> <20090914173208.GA4273@a91-153-125-115.elisa-laajakaista.fi>

next in thread | previous in thread | raw e-mail | index | archive | help

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Sep 14, 2009 at 08:32:09PM +0300, Jaakko Heinonen wrote:
> Calling nmount() with "update" and "export" string options shouldn't
> affect to any other options in any way. The problem is that the mount
> point has both "ro" and "rw" options active before mountd calls
> nmount(). Because of the "ro" option FFS mount code changes the file
> system to read-only. The FFS code looks for "ro" string option only when
> doing mount updates.

Hi,

Instead of using your proposed patch, could you try this patch?

I originally wrote all the has_rw/has_ro stuff for nmount()
in 2006.  Getting the mount update behavior for ro -> rw
was a big pain in the neck, especially because the userland mount
programs and the mount code for the various file systems were slightly
inconsistent.

Looking back, I should have done it this way, but at the time I wasn't sure
how all the mount update stuff worked across the different file systems.

-- 
Craig Rodrigues
rodrigc@crodrigues.org

--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="vfs_mount.c.txt"

Index: sys/kern/vfs_mount.c
===================================================================
--- sys/kern/vfs_mount.c	(revision 190314)
+++ sys/kern/vfs_mount.c	(working copy)
@@ -583,16 +583,13 @@
 vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
 {
 	struct vfsoptlist *optlist;
-	struct vfsopt *opt, *noro_opt, *tmp_opt;
+	struct vfsopt *opt, *tmp_opt;
 	char *fstype, *fspath, *errmsg;
 	int error, fstypelen, fspathlen, errmsg_len, errmsg_pos;
-	int has_rw, has_noro;
 
 	errmsg = NULL;
 	errmsg_len = 0;
 	errmsg_pos = -1;
-	has_rw = 0;
-	has_noro = 0;
 
 	error = vfs_buildopts(fsoptions, &optlist);
 	if (error)
@@ -686,11 +683,11 @@
 		}
 		else if (strcmp(opt->name, "noro") == 0) {
 			fsflags &= ~MNT_RDONLY;
-			has_noro = 1;
 		}
 		else if (strcmp(opt->name, "rw") == 0) {
+			free(opt->name, M_MOUNT);
+			opt->name = strdup("noro", M_MOUNT);
 			fsflags &= ~MNT_RDONLY;
-			has_rw = 1;
 		}
 		else if (strcmp(opt->name, "ro") == 0)
 			fsflags |= MNT_RDONLY;
@@ -708,20 +705,6 @@
 	}
 
 	/*
-	 * If "rw" was specified as a mount option, and we
-	 * are trying to update a mount-point from "ro" to "rw",
-	 * we need a mount option "noro", since in vfs_mergeopts(),
-	 * "noro" will cancel "ro", but "rw" will not do anything.
-	 */
-	if (has_rw && !has_noro) {
-		noro_opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK);
-		noro_opt->name = strdup("noro", M_MOUNT);
-		noro_opt->value = NULL;
-		noro_opt->len = 0;
-		TAILQ_INSERT_TAIL(optlist, noro_opt, link);
-	}
-
-	/*
 	 * Be ultra-paranoid about making sure the type and fspath
 	 * variables will fit in our mp buffers, including the
 	 * terminating NUL.

--CE+1k2dSO48ffgeK--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090915040032.GA68823>