1 ext4: mark inode dirty after converting inline directory
3 From: Eric Biggers <ebiggers@google.com>
5 If ext4_convert_inline_data() was called on a directory with inline
6 data, the filesystem was left in an inconsistent state (as considered by
7 e2fsck) because the file size was not increased to cover the new block.
8 This happened because the inode was not marked dirty after i_disksize
9 was updated. Fix this by marking the inode dirty at the end of
10 ext4_finish_convert_inline_dir().
12 This bug was probably not noticed before because most users mark the
13 inode dirty afterwards for other reasons. But if userspace executed
14 FS_IOC_SET_ENCRYPTION_POLICY with invalid parameters, as exercised by
15 'kvm-xfstests -c adv generic/396', then the inode was never marked dirty
16 after updating i_disksize.
18 Cc: stable@vger.kernel.org # 3.10+
19 Fixes: 3c47d54170b6a678875566b1b8d6dcf57904e49b
20 Signed-off-by: Eric Biggers <ebiggers@google.com>
21 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
23 fs/ext4/inline.c | 5 ++---
24 1 file changed, 2 insertions(+), 3 deletions(-)
26 diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
27 index 3a1f2822541b..75b29c25313c 100644
28 --- a/fs/ext4/inline.c
29 +++ b/fs/ext4/inline.c
30 @@ -1169,10 +1169,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle,
31 set_buffer_uptodate(dir_block);
32 err = ext4_handle_dirty_dirent_node(handle, inode, dir_block);
36 set_buffer_verified(dir_block);
39 + return ext4_mark_inode_dirty(handle, inode);
42 static int ext4_convert_inline_data_nolock(handle_t *handle,
44 2.11.0.483.g087da7b7c-goog