|
08/11/2008 2:13 PM
post11648
|
e2fsck is having a hard time with my ext2 filesystem after QNX has mounted it.
It appears that the group descriptor "bg_flags" field is being paved.
e2fsprogs defines the block desc as:
struct ext2_group_desc
{
__u32 bg_block_bitmap; /* Blocks bitmap block */
__u32 bg_inode_bitmap; /* Inodes bitmap block */
__u32 bg_inode_table; /* Inodes table block */
__u16 bg_free_blocks_count; /* Free blocks count */
__u16 bg_free_inodes_count; /* Free inodes count */
__u16 bg_used_dirs_count; /* Directories count */
__u16 bg_flags;
__u32 bg_reserved[2];
__u16 bg_itable_unused; /* Unused inodes count */
__u16 bg_checksum; /* crc16(s_uuid+grouo_num+group_desc)*/
};
You folks (QNX) define it as:
typedef struct ext2_egroup
{
uint32_t g_block_bmp; /* Location of block bmp */
uint32_t g_inode_bmp; /* Location of inode bmp */
uint32_t g_inode_table; /* Location of inode table */
uint16_t g_free_blocks; /* Free blocks */
uint16_t g_free_inodes; /* Free inodes */
uint16_t g_used_dirs; /* Number of inodes that are directories */
} ext2_egroup_t;
but do the I/O on a structure that is sizeof(struct ext2_group_desc):
public/sys/fs_ext2.h:#define E2FS_GROUP_DES_SIZE 32
It appears that ext2_GroupsSave+ext2_GroupMarshall effectively write stack trash into the bg_flags field.
I think all would be well if QNX preserved (or zeroed) the flags for write-back, but perhaps I am missing a trick...
dave
PS the flags seem to have to do with lazy initialization:
#define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */
#define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */
#define EXT2_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
My assertion is that the stack trash is turning one or more of these on and confusing e2fsck.
|
|
|
|
|