When NFS was converted to the new mount syscall, code was written that sets

the MNT_RDONLY flag if the "ro" option was passed in from userland, and
clears it otherwise.  In the diskless case, the MNT_RDONLY flag is already
set when this code is reached, but there are no mount options, so it was
incorrectly cleared.  Change the logic so the MNT_RDONLY flag is set if the
"ro" option was specified, and left alone otherwise.

Note that the NFS code will still happily let you mount a filesystem RW
even if the server exports it RO.  I'm not sure how to fix that.
This commit is contained in:
Dag-Erling Smørgrav 2005-04-27 14:46:02 +00:00
parent 6230360e99
commit 4104e6bc1d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145598

View File

@ -513,9 +513,7 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp)
int maxio;
s = splnet();
if (vfs_getopt(mp->mnt_optnew, "ro", NULL, NULL))
mp->mnt_flag &= ~MNT_RDONLY;
else
if (vfs_getopt(mp->mnt_optnew, "ro", NULL, NULL) == 0)
mp->mnt_flag |= MNT_RDONLY;
/*
* Silently clear NFSMNT_NOCONN if it's a TCP mount, it makes