From ed909bbe20d3fbeeee65c48dc0df2dbffdf2a0a9 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 16 Aug 2002 17:03:59 -0400 Subject: [PATCH] Fix up extended attribute handling in e2image, resize2fs, and in debugfs's icheck command. --- debugfs/ChangeLog | 5 +++++ debugfs/icheck.c | 9 ++++++++- misc/ChangeLog | 5 +++++ misc/e2image.c | 13 +++++++------ resize/ChangeLog | 5 +++++ resize/resize2fs.c | 11 +++++++++++ 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index b77a62a..ac5cab1 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,3 +1,8 @@ +2002-08-16 Theodore Ts'o + + * icheck.c (do_icheck): Check to see if the block is listed as + part of the extended attribute block. + 2002-07-21 Theodore Ts'o * htree.c (do_htree_dump): Fix a bug where we were not cleanly diff --git a/debugfs/icheck.c b/debugfs/icheck.c index 941c749..75044a6 100644 --- a/debugfs/icheck.c +++ b/debugfs/icheck.c @@ -41,7 +41,7 @@ static int icheck_proc(ext2_filsys fs, e2_blkcnt_t i; for (i=0; i < bw->num_blocks; i++) { - if (bw->barray[i].blk == *block_nr) { + if (!bw->barray[i].ino && bw->barray[i].blk == *block_nr) { bw->barray[i].ino = bw->inode; bw->blocks_left--; } @@ -108,6 +108,13 @@ void do_icheck(int argc, char **argv) while (ino) { if (!inode.i_links_count) goto next; + + if (inode.i_file_acl) { + icheck_proc(fs, &inode.i_file_acl, 0, 0, 0, &bw); + if (bw.blocks_left == 0) + break; + } + if (!ext2fs_inode_has_valid_blocks(&inode)) goto next; /* diff --git a/misc/ChangeLog b/misc/ChangeLog index 0469b71..a10ecc0 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,8 @@ +2002-08-16 Theodore Ts'o + + * e2image.c (write_raw_image_file): Check for an extended + attribute block before checking for has_valid_blocks. + 2002-07-21 Theodore Ts'o * fsck.8.in: Document new fsck exit code, FSCK_CANCELED. diff --git a/misc/e2image.c b/misc/e2image.c index 8c07b10..db8bd64 100644 --- a/misc/e2image.c +++ b/misc/e2image.c @@ -395,8 +395,13 @@ static void write_raw_image_file(ext2_filsys fs, int fd) } if (ino == 0) break; - if (!inode.i_links_count || - !ext2fs_inode_has_valid_blocks(&inode)) + if (!inode.i_links_count) + continue; + if (inode.i_file_acl) { + ext2fs_mark_block_bitmap(meta_block_map, + inode.i_file_acl); + } + if (!ext2fs_inode_has_valid_blocks(&inode)) continue; stashed_ino = ino; @@ -423,10 +428,6 @@ static void write_raw_image_file(ext2_filsys fs, int fd) exit(1); } } - if (inode.i_file_acl) { - ext2fs_mark_block_bitmap(meta_block_map, - inode.i_file_acl); - } } } use_inode_shortcuts(fs, 0); diff --git a/resize/ChangeLog b/resize/ChangeLog index e9bfd21..3ff6f12 100644 --- a/resize/ChangeLog +++ b/resize/ChangeLog @@ -1,3 +1,8 @@ +2002-08-16 Theodore Ts'o + + * resize2fs.c (inode_scan_and_fix): Add code to move the extended + attribute block. + 2002-07-26 Theodore Ts'o * resize2fs.c (block_mover): If there are no blocks to move, diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 67caa40..042e562 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -998,6 +998,17 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs) pb.is_dir = LINUX_S_ISDIR(inode.i_mode); pb.changed = 0; + if (inode.i_file.acl && rfs->bmap) { + new_block = ext2fs_extent_translate(pb->rfs->bmap, + inode.i_file_acl); + if (new_block) { + inode.i_file_acl = new_block; + retval = ext2fs_write_inode(rfs->old_fs, + ino, &inode); + if (retval) goto errout; + } + } + if (ext2fs_inode_has_valid_blocks(&inode) && (rfs->bmap || pb.is_dir)) { pb.ino = ino; -- 1.8.3.1