NetBSD Problem Report #892

From gnats  Wed Mar 22 04:37:36 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.10/8.6.10) with ESMTP id EAA00263 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Wed, 22 Mar 1995 04:37:35 -0800
Message-Id: <199503221225.HAA00662@kolvir.blrc.ma.us>
Date: Wed, 22 Mar 1995 07:25:52 -0500
From: John Kohl <jtk@kolvir.blrc.ma.us>
Reply-To: jtk@kolvir.blrc.ma.us
To: gnats-bugs@NetBSD.ORG, jsp@sequent.com
Subject: union FS doesn't drop vnodes when removing/creating whiteouts
X-Send-Pr-Version: 3.2

>Number:         892
>Category:       kern
>Synopsis:       union FS can lead to stranded inodes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 22 04:50:03 +0000 1995
>Closed-Date:    Tue May 30 09:06:29 +0000 1995
>Last-Modified:  
>Originator:     John Kohl
>Release:        -current, as of 22 March 1995
>Organization:
NetBSD Kernel Hackers `R` Us
>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);
 	}
 }



>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Tue May 30 02:06:29 PDT 1995 
State-Changed-Why:  
Fixed. 
>Unformatted:

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.