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. 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? > Thank you very much! > > Sorry for these simple questions for you, since it's the first time > for me to look into FAT code. Your kindly reply will be appreciated > much, and will help me a lot. > > BTW, where could I find a documentation about Linux FAT? There's not much that I can find. Documentation/filesystems/vfat.txt is outdated (doesn't even list the current maintainer). vfat.txt mentions http://bmrc.berkeley.edu/people/chaffee/fat32.html, which has a little documentation, but don't bother with the patches there -- they are all very old. > Thanks & Regards, > Stephen HTH. --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** - 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