From c3c3434754831646e08df96be0bca79785ae6580 Mon Sep 17 00:00:00 2001 From: Yongqiang Yang Date: Wed, 28 Dec 2011 12:02:13 -0500 Subject: [PATCH] --- yaml --- r: 282960 b: refs/heads/master c: 2aff57b0c052344e8401a8b4a33c2a1ecb0f627c h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ext4/inode.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index e9cb5c076a48..36cadc3fc1eb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 22cdfca5641817060dd724a9c30442f5c0675fcd +refs/heads/master: 2aff57b0c052344e8401a8b4a33c2a1ecb0f627c diff --git a/trunk/fs/ext4/inode.c b/trunk/fs/ext4/inode.c index 92655fd89657..cb0ba9d77a8e 100644 --- a/trunk/fs/ext4/inode.c +++ b/trunk/fs/ext4/inode.c @@ -4647,6 +4647,17 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) return 0; if (is_journal_aborted(journal)) return -EROFS; + /* We have to allocate physical blocks for delalloc blocks + * before flushing journal. otherwise delalloc blocks can not + * be allocated any more. even more truncate on delalloc blocks + * could trigger BUG by flushing delalloc blocks in journal. + * There is no delalloc block in non-journal data mode. + */ + if (val && test_opt(inode->i_sb, DELALLOC)) { + err = ext4_alloc_da_blocks(inode); + if (err < 0) + return err; + } jbd2_journal_lock_updates(journal); jbd2_journal_flush(journal);