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