[ext2resize] [PATCH] fix i_file_acl handling
Status: Inactive
Brought to you by:
adilger
From: Andreas D. <ad...@cl...> - 2006-06-10 18:28:54
|
This patch fixes handling of the EXT2_FEATURE_COMPAT_EA feature. The block referenced by i_file_acl needs to be checked for remapping during filesystem preparation/resize. Patch is proof of concept only, it has not been tested. Suggested method for testing: - create a new (small) filesystem w/o preparation - add an extended attribute on the root inode (should use first available block in first group) with setfattr and/or setfacl - run ext2prepare and/or ext2resize on this filesystem to grow it to need another group descriptor block (which should conflict with the EA block) - without patch it should get a failure because the block isn't relocated - with patch it should relocate the EA block and update the inode (use "debugfs -R 'stat <2>' {dev}" to verify before/after ============================================================================= diff -u -p -r1.34 ext2_block_relocator.c --- src/ext2_block_relocator.c 10 Jun 2006 07:45:55 -0000 1.34 +++ src/ext2_block_relocator.c 10 Jun 2006 18:07:21 -0000 @@ -261,6 +261,12 @@ static int doinode(struct ext2_fs *fs, s blk_t inodeblock; inodeoffset = ext2_get_inode_offset(fs, ino, &inodeblock); + if (inode->i_file_acl) + if (!doblock(fs, state, inode->i_file_acl, inodeblock, + inodeoffset + offsetof(struct ext2_inode, + i_file_acl, 0))) + return 0; + for (i = 0; i < EXT2_NDIR_BLOCKS; i++) if ((blk = inode->i_block[i])) if (!doblock(fs, state, blk, inodeblock, diff -u -p -r1.18 ext2_inode_relocator.c --- src/ext2_inode_relocator.c 10 Jun 2006 07:45:55 -0000 1.18 +++ src/ext2_inode_relocator.c 10 Jun 2006 18:07:21 -0000 @@ -208,6 +208,10 @@ static int dotindblock(struct ext2_fs *f if (S_ISDIR(inode->i_mode)) { blk_t blk; + if (inode->i_file_acl) + if (!doblock(fs, state, inode->i_file_acl)) + return 0; + for (i = 0; i < EXT2_NDIR_BLOCKS; i++) if ((blk = inode->i_block[i])) if (!doblock(fs, state, blk)) Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc. |