summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2008-03-05 08:25:49 +0000
committerrodrigc <rodrigc@FreeBSD.org>2008-03-05 08:25:49 +0000
commitfbbd44cc2de010dead74208bea6cbd581cf92150 (patch)
tree715881740f418f539b327bb437826ea6c3a5475b /sbin/fsck_ffs
parentf278be87418b8dbc1e3ebf79abb2ea0d08ca9bd7 (diff)
downloadFreeBSD-src-fbbd44cc2de010dead74208bea6cbd581cf92150.zip
FreeBSD-src-fbbd44cc2de010dead74208bea6cbd581cf92150.tar.gz
For a mounted file system which is read-only, when
doing the MNT_RELOAD, pass in "ro" and "update" string mount options to nmount() instead of MNT_RDONLY and MNT_UPDATE flags. Due to the complexity of the mount parsing code especially with respect to the root file system, passing in MNT_RDONLY and MNT_UPDATE flags would do weird things and would cause fsck to convert the root file system from a read-only mount to read-write. To test: - boot into single user mode - show mounted file systems with: mount - root file system should be mounted read-only - fsck / - show mounted file systems with: mount - root file system should still be mounted read-only PR: 120319 MFC after: 1 month Reported by: yar
Diffstat (limited to 'sbin/fsck_ffs')
-rw-r--r--sbin/fsck_ffs/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 04c313c..1e6f370 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -532,7 +532,7 @@ chkdoreload(struct statfs *mntp)
* as safely as possible.
*/
if (mntp->f_flags & MNT_RDONLY) {
- fflags = fflags | MNT_UPDATE | MNT_RELOAD;
+ fflags = fflags | MNT_RELOAD;
build_iovec(&iov, &iovlen, "fstype", "ffs", 4);
build_iovec(&iov, &iovlen, "from", mntp->f_mntfromname,
(size_t)-1);
@@ -540,6 +540,8 @@ chkdoreload(struct statfs *mntp)
(size_t)-1);
build_iovec(&iov, &iovlen, "errmsg", errmsg,
sizeof(errmsg));
+ build_iovec(&iov, &iovlen, "update", NULL, 0);
+ build_iovec(&iov, &iovlen, "ro", NULL, 0);
if (nmount(iov, iovlen, fflags) == 0) {
return (0);
}
OpenPOWER on IntegriCloud