]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ext4: protect i_disksize update by i_data_sem in direct write path
authorEryu Guan <guaneryu@gmail.com>
Thu, 22 Mar 2018 15:41:25 +0000 (11:41 -0400)
committerBrian Maly <brian.maly@oracle.com>
Mon, 14 Jan 2019 17:29:19 +0000 (12:29 -0500)
commitc098051d90e95c655ac2367ee935c2816006d692
treef12ad5fb3c52263aa9288c39b7f85cd90219e096
parent3979c19fe2a7f6562d305957209b7f692a781943
ext4: protect i_disksize update by i_data_sem in direct write path

i_disksize update should be protected by i_data_sem, by either taking
the lock explicitly or by using ext4_update_i_disksize() helper. But the
i_disksize updates in ext4_direct_IO_write() are not protected at all,
which may be racing with i_disksize updates in writeback path in
delalloc buffer write path.

This is found by code inspection, and I didn't hit any i_disksize
corruption due to this bug. Thanks to Jan Kara for catching this bug and
suggesting the fix!

Reported-by: Jan Kara <jack@suse.cz>
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Orabug: 28940828

commit 73fdad00b208b139cf43f3163fbc0f67e4c6047c upstream

Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
fs/ext4/indirect.c
code line mismatch

Signed-off-by: Shan Hai <shan.hai@oracle.com>
Reviewed-by: Ashish Samant <ashish.samant@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
fs/ext4/indirect.c