Subject: kern/892: union FS doesn't drop vnodes when removing/creating whiteouts
To: None <gnats-admin@NetBSD.ORG>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: netbsd-bugs
Date: 03/22/1995 04:50:05
>Number: 892
>Category: kern
>Synopsis: union FS can lead to stranded inodes
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 22 04:50:03 1995
>Originator: John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release: -current, as of 22 March 1995
>Environment:
System: NetBSD kolvir 1.0A NetBSD 1.0A (KOLVIR) #144: Wed Mar 22 01:01:05 EST 1995 jtk@kolvir:/u1/NetBSD-current/src/sys/arch/i386/compile/KOLVIR i386
>Description:
When you remove a file from a union filesystem, the union FS does not
release the underlying upper vnode. The vnode/inode hangs around until
the union vnode is recycled (which may not happen if a reboot is not
clean).
>How-To-Repeat:
Mount a union FS, create an upper-layer copy of a lower layer
file, then remove the file. Do an fsck -n on the upper layer, and
you'll see the unreferenced inode. Unmount the union FS, and you'll see
the inode was cleaned up.
>Fix:
This patch is relative to -current; it includes a previous patch for
some locking protocol violations.
--- 1.1.2.1 1995/03/22 04:42:10
+++ union_subr.c 1995/03/22 04:42:22
@@ -949,15 +949,15 @@
union_removed_upper(un)
struct union_node *un;
{
+ union_newupper(un, NULLVP); /* discard the VP we had. */
+ if (un->un_flags & UN_CACHED) {
+ un->un_flags &= ~UN_CACHED;
+ LIST_REMOVE(un, un_cache);
+ }
if (un->un_flags & UN_ULOCK) {
un->un_flags &= ~UN_ULOCK;
VOP_UNLOCK(un->un_uppervp);
- }
-
- if (un->un_flags & UN_CACHED) {
- un->un_flags &= ~UN_CACHED;
- LIST_REMOVE(un, un_cache);
}
}
>Audit-Trail:
>Unformatted: