diff options
author | Yongqiang Yang <xiaoqiangnk@gmail.com> | 2011-12-28 18:02:13 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-12-28 18:02:13 +0100 |
commit | 2aff57b0c052344e8401a8b4a33c2a1ecb0f627c (patch) | |
tree | 48713b187d571baab9951dace5b8ace86289a654 /fs/ext4 | |
parent | ext4: remove unneeded file_remove_suid() from ext4_ioctl() (diff) | |
download | linux-2aff57b0c052344e8401a8b4a33c2a1ecb0f627c.tar.xz linux-2aff57b0c052344e8401a8b4a33c2a1ecb0f627c.zip |
ext4: allocate delalloc blocks before changing journal mode
delalloc blocks should be allocated before changing journal mode,
otherwise they can not be allocated and even more truncate on
delalloc blocks could triggre BUG by flushing delalloc buffers.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inode.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 92655fd89657..cb0ba9d77a8e 100644 --- a/fs/ext4/inode.c +++ b/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); |