From ba8bfa1a6dca8a6b65c6c938f3848e90e26bbe09 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Wed, 15 Feb 2012 18:41:33 -0500 Subject: [PATCH] resize2fs: take s_first_data_block into account for resize2fs -M calculate_minimum_resize_size() forgot to account s_first_data_block into minimum filesystem size. Thus in case the size of filesystem was such that the last group had the minimal size (50 blocks + metadata overhead), the code in adjust_fs_info() decided the group is unneeded, removed it, and in some cases the resizing then failed with ENOSPC. Fix the issue by properly accounting for s_first_data_block in calculate_minimum_resize_size(). Signed-off-by: Jan Kara Signed-off-by: Theodore Ts'o --- resize/resize2fs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 06ce73e..dc2805d 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -2033,6 +2033,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs) if (ext2fs_bg_has_super(fs, groups-1)) overhead += SUPER_OVERHEAD(fs); + overhead += fs->super->s_first_data_block; /* * since our last group doesn't have to be BLOCKS_PER_GROUP large, we -- 1.8.3.1