| Summary: | fsck can't fix "huge" zero length files | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Kevin J. Meehan <kjm> |
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 3.3-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
Kevin J. Meehan
1999-11-23 21:40:00 UTC
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
State Changed From-To: open->closed Fixed in revision 1.21 of src/sbin/fsck_ffs/pass1.c. I'll merge this into -stable in a few days. Thanks for the bug report! |