fix UFS superblock alignment issues
PATCH 1/1 fix UFS superblock alignment issues
ufs2 fails to mount on x86_64, claiming bad magic. This is because ufs_super_block_third's fs_un1 member is padded out by 4 bytes for 8-byte alignment, pushing down the rest of the struct.
Forcing this to be packed solves it. I took a quick look over other on-disk structures and didn't immediately find other problems. I was able to mount & ls a populated ufs2 filesystem w/ this change.
Thanks,
-Eric
include/linux/ufs_fs.h +0 -0
@@ -900,7 +900,7 @@ struct ufs_super_block_third {
__fs64 fs_csaddr; /* blk addr of cyl grp summary area */
__fs64 fs_pendingblocks;/* blocks in process of being freed */
__fs32 fs_pendinginodes;/*inodes in process of being freed */
- } fs_u2;
+ } __attribute__ ((packed)) fs_u2;
} fs_un1;
union {
struct {Quoted 7 lines · Eric Sandeen
ufs2 fails to mount on
x86_64, claiming bad magic. This is because ufs_super_block_third'sfs_un1member is padded out by 4 bytes for 8-byte alignment, pushing down the rest of the struct.Forcing this to be packed solves it. I took a quick look over other on-disk structures and didn't immediately find other problems. I was able to mount & ls a populated ufs2 filesystem w/ this change.
I should also mention that this seems to be a regression from 2.6.17->2.6.18, so perhaps it's a candidate for 2.6.18.x updates.
Thanks,
-Eric
Quoted 11 lines · On Tue, 31 Oct 2006 09:22:30 -0600 Eric Sandeen wrote:
Quoted 7 lines · Eric Sandeen
ufs2 fails to mount on
x86_64, claiming bad magic. This is because ufs_super_block_third'sfs_un1member is padded out by 4 bytes for 8-byte alignment, pushing down the rest of the struct.Forcing this to be packed solves it. I took a quick look over other on-disk structures and didn't immediately find other problems. I was able to mount & ls a populated ufs2 filesystem w/ this change.
I should also mention that this seems to be a regression from 2.6.17->2.6.18, so perhaps it's a candidate for 2.6.18.x updates.
Please send it to [email protected] .
---
~Randy