From owner-freebsd-bugs@FreeBSD.ORG Thu Oct 15 18:40:03 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45130106568D for ; Thu, 15 Oct 2009 18:40:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 08D4C8FC2A for ; Thu, 15 Oct 2009 18:40:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FIe2gq070337 for ; Thu, 15 Oct 2009 18:40:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n9FIe2NW070336; Thu, 15 Oct 2009 18:40:02 GMT (envelope-from gnats) Resent-Date: Thu, 15 Oct 2009 18:40:02 GMT Resent-Message-Id: <200910151840.n9FIe2NW070336@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alexander Haderer Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B34EB1065695 for ; Thu, 15 Oct 2009 18:39:48 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id A2DBF8FC23 for ; Thu, 15 Oct 2009 18:39:48 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FIdmSM092266 for ; Thu, 15 Oct 2009 18:39:48 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n9FIdm1N092259; Thu, 15 Oct 2009 18:39:48 GMT (envelope-from nobody) Message-Id: <200910151839.n9FIdm1N092259@www.freebsd.org> Date: Thu, 15 Oct 2009 18:39:48 GMT From: Alexander Haderer To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/139651: mount: read-only remount of NFS volume does not work X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 18:40:03 -0000 >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: