ext4: fix fdatasync(2) after extent manipulation operations
authorJan Kara <jack@suse.cz>
Mon, 29 May 2017 17:24:55 +0000 (13:24 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jun 2017 11:16:22 +0000 (13:16 +0200)
commitdaa1357ff346a67b68d03e0450de2e87a71d2ddf
tree6ea25d40ec8c877cd1986be8fefbc5a517472696
parent7b9694cb7bf2fcd2b443807423b4b09fbbc3c4ff
ext4: fix fdatasync(2) after extent manipulation operations

commit 67a7d5f561f469ad2fa5154d2888258ab8e6df7c upstream.

Currently, extent manipulation operations such as hole punch, range
zeroing, or extent shifting do not record the fact that file data has
changed and thus fdatasync(2) has a work to do. As a result if we crash
e.g. after a punch hole and fdatasync, user can still possibly see the
punched out data after journal replay. Test generic/392 fails due to
these problems.

Fix the problem by properly marking that file data has changed in these
operations.

Fixes: a4bb6b64e39abc0e41ca077725f2a72c868e7622
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/extents.c
fs/ext4/inode.c