add patch set-ext4_dax_aops-for-dax-files
[ext4-patch-queue.git] / fix-online-resize-with-bigalloc-1k
blobdb514b267fcb67346ec8326d7ca90d3930e80f6a
1 ext4: fix online resizing for bigalloc file systems with a 1k block size
3 An online resize of a file system with the bigalloc feature enabled
4 and a 1k block size would be refused since ext4_resize_begin() did not
5 understand s_first_data_block is 0 for all bigalloc file systems, even
6 when the block size is 1k.
8 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 Cc: stable@vger.kernel.org
10 ---
11  fs/ext4/resize.c | 3 ++-
12  1 file changed, 2 insertions(+), 1 deletion(-)
14 diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
15 index 33655a6eff4d..ebbc663d0798 100644
16 --- a/fs/ext4/resize.c
17 +++ b/fs/ext4/resize.c
18 @@ -19,6 +19,7 @@
20  int ext4_resize_begin(struct super_block *sb)
21  {
22 +       struct ext4_sb_info *sbi = EXT4_SB(sb);
23         int ret = 0;
25         if (!capable(CAP_SYS_RESOURCE))
26 @@ -29,7 +30,7 @@ int ext4_resize_begin(struct super_block *sb)
27           * because the user tools have no way of handling this.  Probably a
28           * bad time to do it anyways.
29           */
30 -       if (EXT4_SB(sb)->s_sbh->b_blocknr !=
31 +       if (EXT4_B2C(sbi, sbi->s_sbh->b_blocknr) !=
32             le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {
33                 ext4_warning(sb, "won't resize using backup superblock at %llu",
34                         (unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr);