[PATCH 3.18 097/124] ext4: mark inode dirty after converting inline directory
- Date: Thu, 20 Apr 2017 08:36:12 +0200
- From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
- Subject: [PATCH 3.18 097/124] ext4: mark inode dirty after converting inline directory
3.18-stable review patch. If anyone has any objections, please let me know.
From: Eric Biggers <ebiggers@xxxxxxxxxx>
commit b9cf625d6ecde0d372e23ae022feead72b4228a6 upstream.
If ext4_convert_inline_data() was called on a directory with inline
data, the filesystem was left in an inconsistent state (as considered by
e2fsck) because the file size was not increased to cover the new block.
This happened because the inode was not marked dirty after i_disksize
was updated. Fix this by marking the inode dirty at the end of
This bug was probably not noticed before because most users mark the
inode dirty afterwards for other reasons. But if userspace executed
FS_IOC_SET_ENCRYPTION_POLICY with invalid parameters, as exercised by
'kvm-xfstests -c adv generic/396', then the inode was never marked dirty
after updating i_disksize.
Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
fs/ext4/inline.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
@@ -1148,10 +1148,9 @@ static int ext4_finish_convert_inline_di
err = ext4_handle_dirty_dirent_node(handle, inode, dir_block);
- goto out;
+ return err;
- return err;
+ return ext4_mark_inode_dirty(handle, inode);
static int ext4_convert_inline_data_nolock(handle_t *handle,