Commit 772653be authored by Eric Biggers's avatar Eric Biggers Committed by Sasha Levin

ext4: mark inode dirty after converting inline directory

[ Upstream commit b9cf625d ]

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
ext4_finish_convert_inline_dir().

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.

Cc: stable@vger.kernel.org  # 3.10+
Fixes: 3c47d541Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent e8959ed1
...@@ -1155,10 +1155,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle, ...@@ -1155,10 +1155,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle,
set_buffer_uptodate(dir_block); set_buffer_uptodate(dir_block);
err = ext4_handle_dirty_dirent_node(handle, inode, dir_block); err = ext4_handle_dirty_dirent_node(handle, inode, dir_block);
if (err) if (err)
goto out;
set_buffer_verified(dir_block);
out:
return err; return err;
set_buffer_verified(dir_block);
return ext4_mark_inode_dirty(handle, inode);
} }
static int ext4_convert_inline_data_nolock(handle_t *handle, static int ext4_convert_inline_data_nolock(handle_t *handle,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment