Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Nov 1999 05:10:06 -0800 (PST)
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/15065: fsck can't fix "huge" zero length files
Message-ID:  <199911241310.FAA26648@freefall.freebsd.org>

index | next in thread | raw e-mail

The following reply was made to PR kern/15065; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: "Kevin J. Meehan" <kjm@arc.umn.edu>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/15065: fsck can't fix "huge" zero length files
Date: Thu, 25 Nov 1999 00:07:11 +1100 (EST)

 On Tue, 23 Nov 1999, Kevin J. Meehan wrote:
 
 > >Description:
 > 
 > 	After a particularly bad week with 3 "double faults", one of 
 > 	the 5 filesystems on the RAID subsystem had some odd files 
 > 	the system pushed to the lost+found directory:
 > 
 > 	c--Sr-S--T 1 cheng  si        147, 0x004f00ac Dec 31  1969 #1261947
 > 	lrwxr-S--- 1 demlow ncs   4638043271730144200 Dec 31  1969 #2484071@ -> 
 > 	s--x--S--- 1 root   wheel 4631321269953217064 Dec 31  1969 #2484095=
 > 
 > 	The size returned by dump was a large negative number and thus broke
 > 	Amanda. An umount and fsck of the filesystem would not fix the above.
 
 Try this fix.  I wrote it to fixed corrupted holey files of size 17TB on ffs
 with a blocksize of 8KB while fixing ffs to support such files.  The fixes
 are incomplete and have not been committed.
 
 diff -c2 pass1.c~ pass1.c
 *** pass1.c~	Sun Aug 29 11:00:46 1999
 --- pass1.c	Sun Aug 29 11:00:57 1999
 ***************
 *** 174,178 ****
   	register struct dinode *dp;
   	struct zlncnt *zlnp;
 ! 	int ndb, j;
   	mode_t mode;
   	char *symbuf;
 --- 174,180 ----
   	register struct dinode *dp;
   	struct zlncnt *zlnp;
 ! 	u_int64_t bigndb;
 ! 	ufs_daddr_t j;
 ! 	u_long ndb;
   	mode_t mode;
   	char *symbuf;
 ***************
 *** 210,220 ****
   		inodirty();
   	}
 ! 	ndb = howmany(dp->di_size, sblock.fs_bsize);
 ! 	if (ndb < 0) {
   		if (debug)
 ! 			printf("bad size %qu ndb %d:",
 ! 				dp->di_size, ndb);
   		goto unknown;
   	}
   	if (mode == IFBLK || mode == IFCHR)
   		ndb++;
 --- 212,223 ----
   		inodirty();
   	}
 ! 	bigndb = howmany(dp->di_size, sblock.fs_bsize);
 ! 	if (bigndb != 0 && (ufs_daddr_t)(bigndb - 1) != bigndb - 1) {
   		if (debug)
 ! 			printf("bad size %qu bigndb %qu:",
 ! 			    dp->di_size, bigndb);
   		goto unknown;
   	}
 + 	ndb = (u_long)bigndb;
   	if (mode == IFBLK || mode == IFCHR)
   		ndb++;
 ***************
 *** 252,256 ****
   		}
   	}
 ! 	for (j = ndb; j < NDADDR; j++)
   		if (dp->di_db[j] != 0) {
   			if (debug)
 --- 255,260 ----
   		}
   	}
 ! 	if (ndb < NDADDR)
 ! 	    for (j = ndb; j < NDADDR; j++)
   		if (dp->di_db[j] != 0) {
   			if (debug)
 ***************
 *** 259,263 ****
   			goto unknown;
   		}
 ! 	for (j = 0, ndb -= NDADDR; ndb > 0; j++)
   		ndb /= NINDIR(&sblock);
   	for (; j < NIADDR; j++)
 --- 263,267 ----
   			goto unknown;
   		}
 ! 	for (j = 0, ndb -= NDADDR; (ufs_daddr_t)ndb > 0; j++)
   		ndb /= NINDIR(&sblock);
   	for (; j < NIADDR; j++)
 
 Bruce
 
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911241310.FAA26648>