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
This commit is contained in:
parent
8bd75bdde4
commit
d8f7b008a7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176822
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user