NetBSD Problem Report #55932

From martin@aprisoft.de  Sat Jan 16 12:20:47 2021
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 266621A924A
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 16 Jan 2021 12:20:47 +0000 (UTC)
Message-Id: <20210116122036.E8F275CC7B9@emmas.aprisoft.de>
Date: Sat, 16 Jan 2021 13:20:36 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: NFS root is not read only
X-Send-Pr-Version: 3.95

>Number:         55932
>Category:       kern
>Synopsis:       NFS root is not read only
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 16 12:25:00 +0000 2021
>Last-Modified:  Sat Jan 16 13:55:00 +0000 2021
>Originator:     Martin Husemann
>Release:        NetBSD 9.99.77
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD martins.aprisoft.de 9.99.77 NetBSD 9.99.77 (GENERIC) #42: Sat Jan 2 21:12:56 CET 2021 martin@martins.aprisoft.de:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

When using a read-only mount for / on a diskless client the mountall
rc.d script fails:

Mounting all file systems...
mount_nfs: emmas:/fire-below on /: Operation not supported
/etc/rc.d/mountall exited with code 1

This is with a /etc/fstab entry like:

# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
emmas:/fire-below       /               nfs     ro
tmpfs                   /tmp            tmpfs   rw,-sram%30
tmpfs                   /var            tmpfs   rw,-sram%30
kernfs                  /kern           kernfs  rw
ptyfs                   /dev/pts        ptyfs   rw
procfs                  /proc           procfs  rw


It seems that NFS can not downgrade from a rw to a ro mount (this is bug 1)
and the kernel NFS mountroot code seems to alread mount / as read-write
(different than all other file systems mounted as root - this is bug 2).

>How-To-Repeat:
s/a

>Fix:
n/a

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/55932: NFS root is not read only
Date: Sat, 16 Jan 2021 13:51:50 -0000 (UTC)

 martin@NetBSD.org writes:

 >and the kernel NFS mountroot code seems to alread mount / as read-write
 >(different than all other file systems mounted as root - this is bug 2).

 Bug 2 seems to be intentional:

         /*
          * Historical practice expects NFS root file systems to
          * be initially mounted r/w.
          */
         mp->mnt_flag &= ~MNT_RDONLY;

 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.