NetBSD Problem Report #42795

From kre@munnari.OZ.AU  Fri Feb 12 11:29:58 2010
Return-Path: <kre@munnari.OZ.AU>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 3970363B896
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 12 Feb 2010 11:29:58 +0000 (UTC)
Message-Id: <201002121128.o1CBSc6b004042@jade.coe.psu.ac.th>
Date: Fri, 12 Feb 2010 18:28:38 +0700 (ICT)
From: kre@munnari.OZ.AU
To: gnats-bugs@gnats.NetBSD.org
Subject: patch to make mounting union filesystems less obnoxious
X-Send-Pr-Version: 3.95

>Number:         42795
>Category:       kern
>Synopsis:       patch to make mounting union filesystems less obnoxious
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    hannken
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 12 11:30:00 +0000 2010
>Closed-Date:    Sun Oct 09 08:55:33 +0000 2011
>Last-Modified:  Sun Oct 09 08:55:33 +0000 2011
>Originator:     Robert Elz
>Release:        NetBSD 5.* & current (both from release to 2010-02-12 & beyond)
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 5.0.2 NetBSD 5.0.2 (JADE-$Revision: 1.12 $) #15: Thu Feb 11 12:42:36 ICT 2010 kre@jade.coe.psu.ac.th:/usr/obj/5/kernels/JADE i386
Architecture: i386
Machine: i386
>Description:
	Sometime just before the release of NetBSD 5, mounting union
	filesystems (mount_union, or mount -t union, not mount -o union)
	was changed (in the kernel) to omit a warning of the dangers of
	using the union filesystem type.

	No question but that using union filesystems can crash the system.
	On the other hand, if used carefully, they work just fine for
	their purpose and cause no problems at all.

	Issuing a warning at ever moount is simply overkill.   If the
	user ignored the warning the first time, and went ahead and did
	it again later, warning again is not going to assist, it is simply
	obnoxious.

	Issuing warnings from the kernel, when the warning could just as
	easily come from mount_union where it could be sent somewhere the
	user issuing the mount will actually see it, and to syslog as well
	if desired, is almost certainly not the right choice - but I am
	not going to fight that battle today.

	Instead, here is a trivial patch, for NetBSD current (but which
	should be pulled up to NetBSD 5 (both netbsd-5 and netbsd-5-0)
	which at least has the effect of reducing the warnings to just once
	per boot.   That's still wrong (issuing warnings from the kernel
	like this), but much less offensive than the way it currently is done.

	(The patch, which was generated using current sources, applies to
	netbsd-5-0 with just 1 line of fuzz).

>How-To-Repeat:
	mkdir /tmp/1 /tmp/2
	mount -t union /tmp/1 /tmp/2
		(if /tmp is a filesystem type that doesn't support union
		mounts, just use some other place.)
	umount & repeat (several times).

	Check /var/log/messages (or the real system console) and see the
	same warning, over and over again.

	Worse, it is two separate lines, so syslog doesn't even get the
	opportunity to do its "last message repeated N times" trick.

>Fix:
	In src/sys/fs/union apply the following patch...

Index: union_vfsops.c
===================================================================
RCS file: /cvsroot/NetBSD/src/sys/fs/union/union_vfsops.c,v
retrieving revision 1.61
diff -u -r1.61 union_vfsops.c
--- union_vfsops.c	8 Jan 2010 11:35:09 -0000	1.61
+++ union_vfsops.c	12 Feb 2010 11:00:33 -0000
@@ -118,6 +118,7 @@
 	char *xp;
 	int len;
 	size_t size;
+	static int whine_annoyingly = 1;

 	if (*data_len < sizeof *args)
 		return EINVAL;
@@ -148,8 +149,11 @@
 		goto bad;
 	}

-	printf("WARNING: the union file system is experimental\n"
-	    "WARNING: it can cause crashes and file system corruption\n");
+	if (whine_annoyingly) {
+		whine_annoyingly = 0;
+		printf("WARNING: the union file system is experimental\n"
+		  "WARNING: it can cause crashes and file system corruption\n");
+	}

 	lowerrootvp = mp->mnt_vnodecovered;
 	vref(lowerrootvp);

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->kern-bug-people
Responsible-Changed-By: tnn@NetBSD.org
Responsible-Changed-When: Fri, 12 Feb 2010 14:09:49 +0000
Responsible-Changed-Why:
pkg -> kern


From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/42795 (patch to make mounting union filesystems less obnoxious)
Date: Fri, 12 Feb 2010 21:58:45 +0700

     Date:        Fri, 12 Feb 2010 14:09:50 +0000 (UTC)
     From:        tnn@NetBSD.org
     Message-ID:  <20100212140950.4D6BF63B896@www.NetBSD.org>

   | Synopsis: patch to make mounting union filesystems less obnoxious
   | pkg -> kern

 Oh, sorry...

 kre

From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42795 CVS commit: src/sys/fs/union
Date: Sun, 28 Aug 2011 08:27:57 +0000

 Module Name:	src
 Committed By:	hannken
 Date:		Sun Aug 28 08:27:57 UTC 2011

 Modified Files:
 	src/sys/fs/union: union_vfsops.c

 Log Message:
 Print the warning message on mount once.

 Should fix PR #42795 (patch to make mounting union filesystems less obnoxious)


 To generate a diff of this commit:
 cvs rdiff -u -r1.63 -r1.64 src/sys/fs/union/union_vfsops.c

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

Responsible-Changed-From-To: kern-bug-people->hannken
Responsible-Changed-By: hannken@NetBSD.org
Responsible-Changed-When: Mon, 29 Aug 2011 08:24:58 +0000
Responsible-Changed-Why:
Take.


State-Changed-From-To: open->pending-pullups
State-Changed-By: hannken@NetBSD.org
State-Changed-When: Mon, 29 Aug 2011 08:24:58 +0000
State-Changed-Why:
Pullup requested (ticket 1667).


From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42795 CVS commit: [netbsd-5] src/sys/fs/union
Date: Sat, 17 Sep 2011 18:54:39 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sat Sep 17 18:54:39 UTC 2011

 Modified Files:
 	src/sys/fs/union [netbsd-5]: union_vfsops.c

 Log Message:
 Pull up following revision(s) (requested by hannken in ticket #1667):
 	sys/fs/union/union_vfsops.c: revision 1.64
 Print the warning message on mount once.
 =20
 Should fix PR #42795 (patch to make mounting union filesystems less =
 obnoxious)
 =20
 =20


 To generate a diff of this commit:
 cvs rdiff -u -r1.57.6.1 -r1.57.6.2 src/sys/fs/union/union_vfsops.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: hannken@NetBSD.org
State-Changed-When: Sun, 09 Oct 2011 08:55:33 +0000
State-Changed-Why:
Pulled up.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.