kern/120319: fsck on read-only root fs upgrades it to read-write

Jaakko Heinonen jh at saunalahti.fi
Thu Feb 7 10:20:03 UTC 2008


The following reply was made to PR kern/120319; it has been noted by GNATS.

From: Jaakko Heinonen <jh at saunalahti.fi>
To: bug-followup at FreeBSD.org, yar at comp.chem.msu.su
Cc:  
Subject: Re: kern/120319: fsck on read-only root fs upgrades it to
	read-write
Date: Thu, 7 Feb 2008 12:19:48 +0200

 --KsGdsel6WgEHnImy
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 
 This happens because the kernel doesn't set the "ro" mount option
 initially for mounts in vfs_mountroot_try() (vfs_mount.c). ffs_mount()
 remounts a file system as read-write if the "ro" option is missing.
 
 Following patch adds the "ro" option for initial root mounts. It should
 fix the problem. Could you verify that?
 
 -- 
 Jaakko
 
 --KsGdsel6WgEHnImy
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="root-remount.diff"
 
 Index: vfs_mount.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/kern/vfs_mount.c,v
 retrieving revision 1.273
 diff -u -r1.273 vfs_mount.c
 --- vfs_mount.c	24 Jan 2008 12:34:28 -0000	1.273
 +++ vfs_mount.c	7 Feb 2008 07:33:00 -0000
 @@ -1727,6 +1727,7 @@
  	    "fstype", vfsname,
  	    "fspath", "/",
  	    "from", path,
 +	    "ro", NULL,
  	    NULL);
  	if (error == 0) {
  		/*
 @@ -2300,7 +2301,10 @@
  		if (cp == NULL)
  			break;
  		vp = va_arg(ap, const void *);
 -		ma = mount_arg(ma, cp, vp, -1);
 +		if (vp == NULL)
 +			ma = mount_arg(ma, cp, NULL, 0);
 +		else
 +			ma = mount_arg(ma, cp, vp, -1);
  	}
  	va_end(ap);
  
 
 --KsGdsel6WgEHnImy--


More information about the freebsd-bugs mailing list