diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2016-12-14 22:36:05 -0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-02-14 15:50:58 +0100 |
commit | 4aaedfb0b68ca83471c5f10f1da7f0f4714080a1 (patch) | |
tree | 5b4ad8d821c4bd0618235f15cf68bcd3b558ceb8 /fs/btrfs/root-tree.c | |
parent | 62c821a8e23ab7bdbc14841fafa3c90e3b057de7 (diff) | |
download | lwn-4aaedfb0b68ca83471c5f10f1da7f0f4714080a1.tar.gz lwn-4aaedfb0b68ca83471c5f10f1da7f0f4714080a1.zip |
Btrfs: fix another race between truncate and lockless dio write
Dio writes can update i_size in btrfs_get_blocks_direct when it
writes to offset beyond EOF so that endio can update disk_i_size
correctly (because we don't udpate disk_i_size beyond i_size).
However, when truncating down a file, we firstly update i_size
and then wait for in-flight lockless dio reads/writes, according
to the above, i_size may have been changed in dio writes, and
file extents don't get truncated.
For lockless dio writes are always overwrites, i_size is not
supposed to be changed, so this adds a check to filter out this
case.
The race could be reproduced by fstests/generic/299 with patch
"Btrfs: fix btrfs_ordered_update_i_size to update disk_i_size properly"
applied.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/root-tree.c')
0 files changed, 0 insertions, 0 deletions