On further examination, there is a ext2fs library bug fix that will
address your issue.  The problem is that if there aren't any pending
superblock or block group descriptors changes that need to be written,
when we write out the bitmap blocks, we update the in-memory checksum
fields but they don't actually get written out to disk.

                                           - Ted

commit 0cdda6cb753657fcd92f2c02198137bd2a65787a
Author: Theodore Ts'o <ty...@mit.edu>
Date:   Mon Jan 1 18:59:16 2018 -0500

    libext2fs: when writing bitmaps mark the fs as dirty if necessary
    
    If any checksum fields are updated in the block group descriptors, we
    need to set the EXT2_FLAG_DIRTY flag so that the block group
    descriptors are written to disk.
    
    Addresses-Debian-Bug: #883869
    
    Signed-off-by: Theodore Ts'o <ty...@mit.edu>

diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index ae593d494..9db76eb94 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -94,6 +94,7 @@ static errcode_t write_bitmaps(ext2_filsys fs, int do_inode, 
int do_block)
                if (retval)
                        return retval;
                ext2fs_group_desc_csum_set(fs, i);
+               fs->flags |= EXT2_FLAG_DIRTY;
 
                blk = ext2fs_block_bitmap_loc(fs, i);
                if (blk) {
@@ -125,6 +126,7 @@ static errcode_t write_bitmaps(ext2_filsys fs, int 
do_inode, int do_block)
                if (retval)
                        goto errout;
                ext2fs_group_desc_csum_set(fs, i);
+               fs->flags |= EXT2_FLAG_DIRTY;
 
                blk = ext2fs_inode_bitmap_loc(fs, i);
                if (blk) {

Reply via email to