mirror of
https://github.com/hardkernel/linux.git
synced 2026-04-03 11:43:03 +09:00
ext4: fix fdatasync(2) after fallocate(2) operation
commitc894aa9757upstream. Currently, fallocate(2) with KEEP_SIZE followed by a fdatasync(2) then crash, we'll see wrong allocated block number (stat -c %b), the blocks allocated beyond EOF are all lost. fstests generic/468 exposes this bug. Commit67a7d5f561("ext4: fix fdatasync(2) after extent manipulation operations") fixed all the other extent manipulation operation paths such as hole punch, zero range, collapse range etc., but forgot the fallocate case. So similarly, fix it by recording the correct journal tid in ext4 inode in fallocate(2) path, so that ext4_sync_file() will wait for the right tid to be committed on fdatasync(2). This addresses the test failure in xfstests test generic/468. Signed-off-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
52425e0428
commit
2c367edaba
@@ -4746,6 +4746,7 @@ retry:
|
||||
EXT4_INODE_EOFBLOCKS);
|
||||
}
|
||||
ext4_mark_inode_dirty(handle, inode);
|
||||
ext4_update_inode_fsync_trans(handle, inode, 1);
|
||||
ret2 = ext4_journal_stop(handle);
|
||||
if (ret2)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user