From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:46111 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753505AbdDJM7l (ORCPT ); Mon, 10 Apr 2017 08:59:41 -0400 From: Jiri Slaby To: stable@vger.kernel.org Cc: Eric Biggers , Theodore Ts'o , Jiri Slaby Subject: [patch added to 3.12-stable] ext4: mark inode dirty after converting inline directory Date: Mon, 10 Apr 2017 14:58:57 +0200 Message-Id: <20170410125930.26495-20-jslaby@suse.cz> In-Reply-To: <20170410125930.26495-1-jslaby@suse.cz> References: <20170410125930.26495-1-jslaby@suse.cz> Sender: stable-owner@vger.kernel.org List-ID: From: Eric Biggers This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== 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 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. Fixes: 3c47d54170b6a678875566b1b8d6dcf57904e49b Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o Signed-off-by: Jiri Slaby --- fs/ext4/inline.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index a4d6e9a953f9..af053f3105b8 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -1146,10 +1146,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle, set_buffer_uptodate(dir_block); err = ext4_handle_dirty_dirent_node(handle, inode, dir_block); if (err) - goto out; + return err; set_buffer_verified(dir_block); -out: - return err; + return ext4_mark_inode_dirty(handle, inode); } static int ext4_convert_inline_data_nolock(handle_t *handle, -- 2.12.2