Messages in this thread | | | Date | Wed, 20 Jan 1999 15:18:39 +0800 (WST) | From | John Summerfield <> | Subject | Re: I *need* to know what this is. |
| |
On Tue, 19 Jan 1999, Jeremy Hansen wrote:
> > EXT2-fs error (device 08:01): ext2_find_entry: bad entry in directory > #284673: rec_len is too small for name_len - offset=1436, inode=284754, > rec_len=20, name_len=41
Unfortunately this message (like so many emanating from linux) serves to fortify the sterotype of programmers that they can't write clear documentation: by "documentation" I include error messages.
> > We have burned three machines now and all three are getting the same > error. I need to have an idea what this is. I find it hard to > believe that we happen to get three bad drives in a row. All hardware > has been switched out at least three times. > > I need an *answer* on this. > > Please cc me if possible. Here's how to find the source of the message: with the source code in place, [summer@possum summer]$ find /usr/src/linux/ -type f -exec grep "rec_len is too small for" m '{}' ';' /usr/src/linux/fs/ext2/dir.c: error_msg = "rec_len is too small for name_len"; [summer@possum summer]$ Now we see it came from /usr/src/linux/fs/ext2/dir.c Here's the relevant code snippet: =========================== begin =========================== int ext2_check_dir_entry (const char * function, struct inode * dir, struct ext2_dir_entry * de, struct buffer_head * bh, unsigned long offset) { const char * error_msg = NULL;
if (de->rec_len < EXT2_DIR_REC_LEN(1)) error_msg = "rec_len is smaller than minimal"; else if (de->rec_len % 4 != 0) error_msg = "rec_len % 4 != 0"; else if (de->rec_len < EXT2_DIR_REC_LEN(de->name_len)) error_msg = "rec_len is too small for name_len"; else if (dir && ((char *) de - bh->b_data) + de->rec_len > dir->i_sb->s_blocksize) error_msg = "directory entry across blocks"; else if (dir && de->inode > dir->i_sb->u.ext2_sb.s_es->s_inodes_count) error_msg = "inode out of bounds";
if (error_msg != NULL) ext2_error (dir->i_sb, function, "bad entry in directory #%lu: %s - " "offset=%lu, inode=%lu, rec_len=%d, name_len=%d", dir->i_ino, error_msg, offset, (unsigned long) de->inode, de->rec_len, de->name_len); return error_msg == NULL ? 1 : 0; } =========================== end ===========================
Note that in this code fragment I include all the accompanying comments.
The best I can surmise is that the directory has been corrupted. this could arise from hardware (disk or controller), an untimely power failure (or hitting the reset button) or from a software error, If the last, then code attempting to recover from a hardware error is a likely candidate as it's notoriously difficult to test.
Note that if you copy a disk image containing an error, you will also copy the error. If you copy file-by-file and the directory contains errors, then the result of the copy is suspect.
Final diagnosis of what went wrong has to be tempered with local knowledge of what actually took place, and any recovery plan has to take into account the diagnosis.
-- Cheers John Summerfield http://os2.ami.com.au/os2/ for OS/2 support. Configuration, networking, combined IBM ftpsites index.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |