8.0-BETA4 panic: ffs_sync: rofs mod

Craig Rodrigues rodrigc at crodrigues.org
Tue Sep 15 04:00:32 UTC 2009


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 at crodrigues.org
-------------- next part --------------
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.


More information about the freebsd-current mailing list