Randy Dunlap <randy.dunlap@xxxxxxxxxx> writes: > On Wed, 29 Aug 2007 17:27:07 +0800 常青 wrote: > > [adding maintainer cc:] > >> I've been encountered with a FAT panic, saying, >> ===================================== >> Filesystem panic (dev mmcblk0p1) >> fat_get_cluster: invalid cluster chain (i_pos 16021) >> File system has been set read-only >> ===================================== >> >> After tracking into kernel code, I find this is printed out by >> fat_get_cluster@fs/fat/cache.c , >> ===================================== >> nr = fat_access(sb, *dclus, -1); >> if (nr < 0) >> return nr; >> else if (nr == FAT_ENT_FREE) { >> fat_fs_panic(sb, "%s: invalid cluster chain" >> " (i_pos %lld)", __FUNCTION__, >> MSDOS_I(inode)->i_pos); >> return -EIO; >> } else if (nr == FAT_ENT_EOF) { >> fat_cache_add(inode, &cid); >> return FAT_ENT_EOF; >> } >> ===================================== >> >> Could you please help to explain what does FAT_ENT_FREE mean? and what >> condition will lead to (nr == FAT_ENT_FREE) to be true? > > #define FAT_ENT_FREE (0) > > It means that the FAT filesystem cluster chain came upon an entry > with a value of 0, which is invalid. I.e., it means that this > cluster (of blocks) is free, not part of a file, but the code was > trying to follow a chain of clusters for a file, in which case it > should never see a 0, just valid cluster links until EOF (value) > is reached. > > Sounds like the FAT is corrupted. Yes. > Hirofumi, is there second copy of the FAT table? If so, is there > a way to use it? or just dd copy#2 to copy#1? If this is FAT12, it doesn't have a copy of FAT. IIRC, "dosfsck -v -n -r" will check and display whether FATs have difference, and if those have the difference, it will ask which FAT you use. Thanks. -- OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html