bin/139651: mount: read-only remount of NFS volume does not work

Alexander Haderer alexander.haderer at loescap.de
Thu Oct 15 18:40:03 UTC 2009


>Number:         139651
>Category:       bin
>Synopsis:       mount: read-only remount of NFS volume does not work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 15 18:40:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Haderer
>Release:        Freebsd 7.2R
>Organization:
LoeScap Technology GmbH
>Environment:
FreeBSD xxxxxxx 7.2-RELEASE-p4 FreeBSD 7.2-RELEASE-p4 #0: Fri Oct  2 12:21:39 UTC 2009     root at i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
When trying to read-only remount a NFS volume with 'mount -u -r /mnt' the volume will be/remain mounted read-write. Neither the mount command nor the logfiles show any diagnostics, mount's exitcode is 0.

Note: This problem is strongly related to PR 136470

   kern/136470: [nfs] Cannot mount / in read-only, over NFS

PR Summary: A network booted machine has root NFS mounted read-write, although in rc.conf   root_rw_mount="NO"  is set. 

Because I run diskless setups, I stumbled over the same problem and found the PR above. My further investigations of such a network boot environment show, that rc.d/root respects the config var set, but later rc.d/mountcritremote calls "mount -a -t nfs", which will silently remount / as read-write.

I marked this PR as serious because with the current behaviour of mount one can accidently read-write mount a volume.
>How-To-Repeat:
Setup an NFS server (here: FreeBSD 4.9 running a NFS server with defaults), then goto 7.2 nfs client machine and do:

# mount server:/fs /mnt
# mount
server:/fs on /mnt (nfs)
# mount -u -r /mnt
# mount
server:/fs on /mnt (nfs)
# umount /mnt

# mount -r server:/fs /mnt
# mount
server:/fs on /mnt (nfs, read-only)
# mount -u -r /mnt
# mount
server:/fs on /mnt (nfs)

>Fix:
Only workarounds:

- make the exported filesystem read-only
- export the NFS volume as read-only
- umount and NFS remount read-only



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list