ext4: fix fdatasync(2) after extent manipulation operations
authorJan Kara <jack@suse.cz>
Mon, 29 May 2017 17:24:55 +0000 (13:24 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 15 Sep 2017 17:30:48 +0000 (18:30 +0100)
commit99da954f8787a01791c59517caa7aa3cc28eb0ae
tree2cbc2a1fe4a75608290f5d6c68276e012b0ee81a
parent793736b192ee397205c24a424b3a5fa2ec82086b
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>
[bwh: Backported to 3.2: Only the punch-hole operation is supported, and
 it's in extents.c.]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/extents.c