Path: utzoo!attcan!uunet!mcvax!ukc!acorn!dave From: dave@acorn.co.uk (Dave Lamkin) Newsgroups: comp.bugs.4bsd Subject: Re: 4.3 Tahoe dump bug Summary: Why the "this cannot happen message happens" with dump on NFS systems Keywords: dump bug Message-ID: <599@acorn.co.uk> Date: 20 Dec 88 18:39:39 GMT References: <23685@pprg.unm.edu> Organization: Acorn Computers Limited, Cambridge, UK Lines: 57 BSD 4.3 file systems ensured that a directory length was a multiple of DEV_BSIZE, this is not the case on NFS 3.2 versions of BSD. This causes problems with fsck and dump. fsck will find (&hence fix) "errors" with directory lengths from time to time. dump when encountering a directory which is not a multiple of 512 bytes long will fail to read it with the errors as described. The fix is to round up the request length to the bread routine to a multiple of DEV_BSIZE. This is done in the routine dsrch in dumptraverse.c as below. A workaround is to fsck the disc prior to dumping. ------------------------------------------------------------------------------ dsrch(d, size, filesize) daddr_t d; int size, filesize; { register struct direct *dp; long loc; char dblk[MAXBSIZE]; if(dadded) return; if (filesize > size) filesize = size; /* +++++++++++++ Fix start ++++++++++ * Extend the length of the directory. * NFS 3.2 no longer ensures multiple of DEV_BSIZE */ filesize = (filesize + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1); /* ------------- Fix end ----------- */ bread(fsbtodb(sblock, d), dblk, filesize); for (loc = 0; loc < filesize; ) { dp = (struct direct *)(dblk + loc); if (dp->d_reclen == 0) { msg("corrupted directory, inumber %d\n", ino); break; } loc += dp->d_reclen; if(dp->d_ino == 0) continue; if(dp->d_name[0] == '.') { if(dp->d_name[1] == '\0') continue; if(dp->d_name[1] == '.' && dp->d_name[2] == '\0') continue; } if(BIT(dp->d_ino, nodmap)) { dadded++; return; } if(BIT(dp->d_ino, dirmap)) nsubdir++; } }