NetBSD Problem Report #60456

From www@netbsd.org  Fri Jul 17 18:49:32 2026
Return-Path: <www@netbsd.org>
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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "YR2" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0CEE21A923B
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 17 Jul 2026 18:49:32 +0000 (UTC)
Message-Id: <20260717184931.17F2F1A923C@mollari.NetBSD.org>
Date: Fri, 17 Jul 2026 18:49:31 +0000 (UTC)
From: thorpej@me.com
Reply-To: thorpej@me.com
To: gnats-bugs@NetBSD.org
Subject: FFS_NO_SNAPSHOT option is not entirely effective
X-Send-Pr-Version: www-1.0
X-From4GNATS: "thorpej@me.com via gnats" <gnats-admin@NetBSD.org>

>Number:         60456
>Category:       kern
>Synopsis:       FFS_NO_SNAPSHOT option is not entirely effective
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 17 18:50:00 +0000 2026
>Last-Modified:  Wed Jul 22 14:45:01 +0000 2026
>Originator:     Jason Thorpe
>Release:        11.99.7
>Organization:
Retrogrouches R Us
>Environment:
NetBSD icarus 11.99.7 NetBSD 11.99.7 (PHAETHON1) #137: Fri Jul 17 08:56:41 PDT 2026  thorpej@dhcp-105.ktnet:/Users/thorpej/NetBSD/current/src/sys/arch/hb68k/compile/PHAETHON1 hb68k
>Description:
The FFS_NO_SNAPSHOT option exists, yet when it is enabled, I pay for nearly 2 pages of .text on my machine:

dhcp-105:thorpej$ m68k--netbsdelf-size ffs_snapshot.o 
   text	   data	    bss	    dec	    hex	filename
   7713	      0	      0	   7713	   1e21	ffs_snapshot.o
dhcp-105:thorpej$ 

opt_ffs.h:#define	FFS_NO_SNAPSHOT	1

>How-To-Repeat:
Enable FFS_NO_SNAPSHOT, build kernel, observe that ffs_snapshot.o is still built and contains progbits.
>Fix:
Yes please.

>Audit-Trail:
From: "J. Hannken-Illjes" <hannken@mailbox.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/60456: FFS_NO_SNAPSHOT option is not entirely effective
Date: Fri, 17 Jul 2026 22:26:53 +0200

 This is intentional, option FFS_NO_SNAPSHOT disables snapshot creation while
 already existing snapshots continue to work to prevent snapshot corruption
 when running the wrong kernel.

 --
 J. Hannken-Illjes - hannken@mailbox.org

From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: kern/60456: FFS_NO_SNAPSHOT option is not entirely effective
Date: Fri, 17 Jul 2026 14:05:02 -0700

 --Apple-Mail=_0E9501C1-7ADB-4A12-B3B9-FA7E067F0597
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8


 > On Jul 17, 2026, at 1:40=E2=80=AFPM, J. Hannken-Illjes via gnats =
 <gnats-admin@NetBSD.org> wrote:
 >=20
 > This is intentional, option FFS_NO_SNAPSHOT disables snapshot creation =
 while
 > already existing snapshots continue to work to prevent snapshot =
 corruption
 > when running the wrong kernel.

 So how to I elide all of the FFS snapshot code from the kernel?  I =
 don=E2=80=99t use them, nor do I ever care to and want the memory =
 savings.

 -- thorpej


 --Apple-Mail=_0E9501C1-7ADB-4A12-B3B9-FA7E067F0597
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/html;
 	charset=utf-8

 <html aria-label=3D"message body"><head><meta http-equiv=3D"content-type" =
 content=3D"text/html; charset=3Dutf-8"></head><body =
 style=3D"overflow-wrap: break-word; -webkit-nbsp-mode: space; =
 line-break: after-white-space;"><br><div><blockquote type=3D"cite"><div>On=
  Jul 17, 2026, at 1:40=E2=80=AFPM, J. Hannken-Illjes via gnats =
 &lt;gnats-admin@NetBSD.org&gt; wrote:</div><div><div><br> This is =
 intentional, option FFS_NO_SNAPSHOT disables snapshot creation while<br> =
 already existing snapshots continue to work to prevent snapshot =
 corruption<br> when running the wrong =
 kernel.<br></div></div></blockquote><div><br></div><div>So how to I =
 elide all of the FFS snapshot code from the kernel? &nbsp;I don=E2=80=99t =
 use them, nor do I ever care to and want the memory =
 savings.</div></div><br><div>
 <span class=3D"Apple-style-span" style=3D"border-collapse: separate; =
 color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; =
 font-style: normal; font-variant: normal; font-weight: normal; =
 letter-spacing: normal; line-height: normal; orphans: 2; text-align: =
 auto; text-indent: 0px; text-transform: none; white-space: normal; =
 widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; =
 -webkit-border-vertical-spacing: 0px; =
 -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
 auto; -webkit-text-stroke-width: 0px; "><div style=3D"word-wrap: =
 break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
 after-white-space; ">-- thorpej</div></span>

 </div>
 <br></body></html>=

 --Apple-Mail=_0E9501C1-7ADB-4A12-B3B9-FA7E067F0597--

From: Taylor R Campbell <riastradh@NetBSD.org>
To: Jason Thorpe <thorpej@me.com>
Cc: "J. Hannken-Illjes" <hannken@mailbox.org>,
	netbsd-bugs@NetBSD.org,
	gnats-bugs@NetBSD.org
Subject: Re: kern/60456: FFS_NO_SNAPSHOT option is not entirely effective
Date: Sat, 18 Jul 2026 19:51:35 +0000

 Perhaps we should have an option that elides all of the file system
 snapshot code, but adds a small check so that if you try to mount a
 file system with any snapshots, it refuses to mount read/write -- only
 allows mounting file systems with snapshots read-only, so that you
 won't inadvertently corrupt the snapshots.

 (That said: it's really nice to have fs-internal snapshots, for
 reliable backups and for system updates, without having to rely on a
 snapshot mechanism for the storage medium.  Maybe if you're just
 running a VM, or you're booting from an SD card that you can easily
 swap, none of that matters, but if the storage medium itself isn't
 easily snapshottable or swappable, ffs snapshots are very useful.)

From: Jason Thorpe <thorpej@me.com>
To: Taylor R Campbell <riastradh@NetBSD.org>
Cc: "J. Hannken-Illjes" <hannken@mailbox.org>,
 "netbsd-bugs@netbsd.org" <netbsd-bugs@NetBSD.org>,
 "gnats-bugs@netbsd.org" <gnats-bugs@NetBSD.org>
Subject: Re: kern/60456: FFS_NO_SNAPSHOT option is not entirely effective
Date: Sat, 18 Jul 2026 14:53:08 -0700

 > On Jul 18, 2026, at 12:51=E2=80=AFPM, Taylor R Campbell =
 <riastradh@NetBSD.org> wrote:
 >=20
 > Perhaps we should have an option that elides all of the file system
 > snapshot code, but adds a small check so that if you try to mount a
 > file system with any snapshots, it refuses to mount read/write -- only
 > allows mounting file systems with snapshots read-only, so that you
 > won't inadvertently corrupt the snapshots.

 Indeed, vfs_trans.c also contributes a non-trivial bit of .text on smol =
 machines.

 -- thorpej

From: Taylor R Campbell <riastradh@NetBSD.org>
To: Jason Thorpe <thorpej@me.com>
Cc: "J. Hannken-Illjes" <hannken@mailbox.org>,
	netbsd-bugs@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: kern/60456: FFS_NO_SNAPSHOT option is not entirely effective
Date: Sat, 18 Jul 2026 21:58:28 +0000

 > Date: Sat, 18 Jul 2026 14:53:08 -0700
 > From: Jason Thorpe <thorpej@me.com>
 >=20
 > > On Jul 18, 2026, at 12:51=E2=80=AFPM, Taylor R Campbell <riastradh@NetB=
 SD.org> wrote:
 > >=20
 > > Perhaps we should have an option that elides all of the file system
 > > snapshot code, but adds a small check so that if you try to mount a
 > > file system with any snapshots, it refuses to mount read/write -- only
 > > allows mounting file systems with snapshots read-only, so that you
 > > won't inadvertently corrupt the snapshots.
 >=20
 > Indeed, vfs_trans.c also contributes a non-trivial bit of .text on
 > smol machines.

 vfs_trans.c is for a lot more than just snapshots -- e.g., it is
 needed for unmounting or changing mount options, or for revoking
 vnodes either with revoke(2) (closing ttys) or detaching devices.
 Perhaps you can #ifdef out the cow pastures of vfs_trans.c but not the
 other parts.

From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60456 CVS commit: src/sys/ufs
Date: Wed, 22 Jul 2026 14:44:49 +0000

 Module Name:	src
 Committed By:	hannken
 Date:		Wed Jul 22 14:44:49 UTC 2026

 Modified Files:
 	src/sys/ufs: files.ufs
 	src/sys/ufs/ffs: ffs_alloc.c ffs_inode.c ffs_snapshot.c ffs_vfsops.c
 	src/sys/ufs/ufs: ufs_readwrite.c

 Log Message:
 Expand option FFS_NO_SNAPSHOT to completely remove snapshot support.

 File systems with snapshots cannot be mounted read/write to prevent
 damage to snapshots.

 PR kern/60456 "FFS_NO_SNAPSHOT option is not entirely effective"


 To generate a diff of this commit:
 cvs rdiff -u -r1.52 -r1.53 src/sys/ufs/files.ufs
 cvs rdiff -u -r1.174 -r1.175 src/sys/ufs/ffs/ffs_alloc.c
 cvs rdiff -u -r1.131 -r1.132 src/sys/ufs/ffs/ffs_inode.c
 cvs rdiff -u -r1.156 -r1.157 src/sys/ufs/ffs/ffs_snapshot.c
 cvs rdiff -u -r1.384 -r1.385 src/sys/ufs/ffs/ffs_vfsops.c
 cvs rdiff -u -r1.130 -r1.131 src/sys/ufs/ufs/ufs_readwrite.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.