NetBSD Problem Report #1084

From gnats  Mon May 29 23:31:52 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 XAA00884 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 29 May 1995 23:31:51 -0700
Message-Id: <199505300303.XAA00569@kolvir.blrc.ma.us>
Date: Mon, 29 May 1995 23:03:38 -0400
From: John Kohl <jtk@kolvir.blrc.ma.us>
Reply-To: jtk@kolvir.blrc.ma.us
To: gnats-bugs@NetBSD.ORG
Cc: mycroft@NetBSD.ORG
Subject: whiteout bug in UFS can truncate your directories
X-Send-Pr-Version: 3.2

>Number:         1084
>Category:       kern
>Synopsis:       use of whiteouts can cause directories to be erroneously truncated
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 29 23:35:05 +0000 1995
>Closed-Date:    Tue Jul 11 13:47:55 +0000 1995
>Last-Modified:  
>Originator:     John Kohl
>Release:        -current as of about May 20th
>Organization:
NetBSD Kernel Hackers `R` Us
>Environment:

System: NetBSD kolvir 1.0A NetBSD 1.0A (KOLVIR) #398: Mon May 29 22:38:06 EDT 1995 jtk@kolvir:/u1/NetBSD-current/src/sys/arch/i386/compile/KOLVIR i386


>Description:

Using the union FS can lead to loss of upper-layer file system entries
in UFS.

>How-To-Repeat:

Mount a union FS.  Create enough local entries to get more than one file
system block's worth of dirents.  Rename the first "local" entry in the
directory to some longer name, then rename it back.  Watch your
directory get truncated [see the bottom of ufs_direnter2()].  Get very
very pissed off, calm down, and then run FSCK manually to clean up.

>Fix:

===================================================================
RCS file: RCS/ufs_lookup.c,v
retrieving revision 1.1
diff -c -r1.1 ufs_lookup.c
*** ufs_lookup.c	1995/05/30 02:28:51	1.1
--- ufs_lookup.c	1995/05/30 02:28:57
***************
*** 337,343 ****
  					slotoffset = dp->i_offset;
  					slotsize = ep->d_reclen;
  					dp->i_reclen = slotsize;
! 					enduseful = slotoffset + slotsize;
  					ap->a_cnp->cn_flags |= ISWHITEOUT;
  					numdirpasses--;
  					goto notfound;
--- 337,347 ----
  					slotoffset = dp->i_offset;
  					slotsize = ep->d_reclen;
  					dp->i_reclen = slotsize;
! 					/* enduseful must point to beyond
! 					   the last in-use dirent in this
! 					   directory, NOT to the end of this
! 					   slot! */
! 					enduseful = endsearch;
  					ap->a_cnp->cn_flags |= ISWHITEOUT;
  					numdirpasses--;
  					goto notfound;


p.s. Charles, please excuse the cc:; I know lamp is not working and
won't see this bug report.  It's serious enough that I think you should
see it >now<.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: mycroft 
State-Changed-When: Tue May 30 03:44:40 PDT 1995 
State-Changed-Why:  
Should be fixed now.

State-Changed-From-To: feedback->closed
State-Changed-By: jtc
State-Changed-When: Tue Jul 11 13:47:55 1995
State-Changed-Why:
John has confirmed fix.

>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.