pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/42795: patch to make mounting union filesystems less obnoxious



>Number:         42795
>Category:       pkg
>Synopsis:       patch to make mounting union filesystems less obnoxious
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 12 11:30:00 +0000 2010
>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@localhost:/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);



Home | Main Index | Thread Index | Old Index