Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Oct 2009 18:39:48 GMT
From:      Alexander Haderer <alexander.haderer@loescap.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/139651: mount: read-only remount of NFS volume does not work
Message-ID:  <200910151839.n9FIdm1N092259@www.freebsd.org>
Resent-Message-ID: <200910151840.n9FIe2NW070336@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910151839.n9FIdm1N092259>