|
|
ec15cf |
commit f3745728bc254892da4c569ba3fd8801895f3524
|
|
|
ec15cf |
Author: Eric Sandeen <sandeen@redhat.com>
|
|
|
ec15cf |
Date: Sun Mar 6 21:51:23 2016 -0500
|
|
|
ec15cf |
|
|
|
ec15cf |
resize2fs: clear uninit BG if allocating from new group
|
|
|
ec15cf |
|
|
|
ec15cf |
If resize2fs_get_alloc_block() allocates from a BLOCK_UNINIT group, we
|
|
|
ec15cf |
need to make sure that the UNINIT flag is cleared on both file system
|
|
|
ec15cf |
structures which are maintained by resize2fs. This causes the
|
|
|
ec15cf |
modified bitmaps to not get written out, which leads to post-resize2fs
|
|
|
ec15cf |
e2fsck errors; used blocks in UNINIT groups, not marked in the block
|
|
|
ec15cf |
bitmap. This was seen on r_ext4_small_bg.
|
|
|
ec15cf |
|
|
|
ec15cf |
This patch uses clear_block_uninit() to clear the flag,
|
|
|
ec15cf |
and my problem goes away.
|
|
|
ec15cf |
|
|
|
ec15cf |
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
ec15cf |
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
ec15cf |
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
|
|
|
ec15cf |
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
|
ec15cf |
|
|
|
ec15cf |
Index: e2fsprogs-1.42.9/lib/ext2fs/alloc.c
|
|
|
ec15cf |
===================================================================
|
|
|
ec15cf |
--- e2fsprogs-1.42.9.orig/lib/ext2fs/alloc.c
|
|
|
ec15cf |
+++ e2fsprogs-1.42.9/lib/ext2fs/alloc.c
|
|
|
ec15cf |
@@ -27,6 +27,22 @@
|
|
|
ec15cf |
#include "ext2fs.h"
|
|
|
ec15cf |
|
|
|
ec15cf |
/*
|
|
|
ec15cf |
+ * Clear the uninit block bitmap flag if necessary
|
|
|
ec15cf |
+ */
|
|
|
ec15cf |
+void ext2fs_clear_block_uninit(ext2_filsys fs, dgrp_t group)
|
|
|
ec15cf |
+{
|
|
|
ec15cf |
+ if (!(ext2fs_bg_flags_test(fs, group, EXT2_BG_BLOCK_UNINIT)))
|
|
|
ec15cf |
+ return;
|
|
|
ec15cf |
+
|
|
|
ec15cf |
+ /* uninit block bitmaps are now initialized in read_bitmaps() */
|
|
|
ec15cf |
+
|
|
|
ec15cf |
+ ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
|
|
|
ec15cf |
+ ext2fs_group_desc_csum_set(fs, group);
|
|
|
ec15cf |
+ ext2fs_mark_super_dirty(fs);
|
|
|
ec15cf |
+ ext2fs_mark_bb_dirty(fs);
|
|
|
ec15cf |
+}
|
|
|
ec15cf |
+
|
|
|
ec15cf |
+/*
|
|
|
ec15cf |
* Check for uninit block bitmaps and deal with them appropriately
|
|
|
ec15cf |
*/
|
|
|
ec15cf |
static void check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map,
|
|
|
ec15cf |
Index: e2fsprogs-1.42.9/lib/ext2fs/ext2fs.h
|
|
|
ec15cf |
===================================================================
|
|
|
ec15cf |
--- e2fsprogs-1.42.9.orig/lib/ext2fs/ext2fs.h
|
|
|
ec15cf |
+++ e2fsprogs-1.42.9/lib/ext2fs/ext2fs.h
|
|
|
ec15cf |
@@ -639,6 +639,7 @@ static inline int ext2fs_needs_large_fil
|
|
|
ec15cf |
}
|
|
|
ec15cf |
|
|
|
ec15cf |
/* alloc.c */
|
|
|
ec15cf |
+extern void ext2fs_clear_block_uninit(ext2_filsys fs, dgrp_t group);
|
|
|
ec15cf |
extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
|
|
|
ec15cf |
ext2fs_inode_bitmap map, ext2_ino_t *ret);
|
|
|
ec15cf |
extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,
|
|
|
ec15cf |
Index: e2fsprogs-1.42.9/resize/resize2fs.c
|
|
|
ec15cf |
===================================================================
|
|
|
ec15cf |
--- e2fsprogs-1.42.9.orig/resize/resize2fs.c
|
|
|
ec15cf |
+++ e2fsprogs-1.42.9/resize/resize2fs.c
|
|
|
ec15cf |
@@ -1196,6 +1196,7 @@ static errcode_t resize2fs_get_alloc_blo
|
|
|
ec15cf |
{
|
|
|
ec15cf |
ext2_resize_t rfs = (ext2_resize_t) fs->priv_data;
|
|
|
ec15cf |
blk64_t blk;
|
|
|
ec15cf |
+ int group;
|
|
|
ec15cf |
|
|
|
ec15cf |
blk = get_new_block(rfs);
|
|
|
ec15cf |
if (!blk)
|
|
|
ec15cf |
@@ -1208,6 +1209,12 @@ static errcode_t resize2fs_get_alloc_blo
|
|
|
ec15cf |
|
|
|
ec15cf |
ext2fs_mark_block_bitmap2(rfs->old_fs->block_map, blk);
|
|
|
ec15cf |
ext2fs_mark_block_bitmap2(rfs->new_fs->block_map, blk);
|
|
|
ec15cf |
+
|
|
|
ec15cf |
+ group = ext2fs_group_of_blk2(rfs->old_fs, blk);
|
|
|
ec15cf |
+ ext2fs_clear_block_uninit(rfs->old_fs, group);
|
|
|
ec15cf |
+ group = ext2fs_group_of_blk2(rfs->new_fs, blk);
|
|
|
ec15cf |
+ ext2fs_clear_block_uninit(rfs->new_fs, group);
|
|
|
ec15cf |
+
|
|
|
ec15cf |
*ret = (blk64_t) blk;
|
|
|
ec15cf |
return 0;
|
|
|
ec15cf |
}
|