Btrfs: fix truncate down when no_holes feature is enabled
authorLiu Bo <bo.li.liu@oracle.com>
Thu, 1 Dec 2016 21:43:31 +0000 (13:43 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Jul 2017 12:37:18 +0000 (14:37 +0200)
commit6e1116a0b3e23b1c0d8a7aa9a365de603d2dc3fe
tree094ce4f71236672ca1d4dda0e23ef6d443854688
parent961efcd54e5be36326d809a5b3c934c022e5b024
Btrfs: fix truncate down when no_holes feature is enabled

[ Upstream commit 91298eec05cd8d4e828cf7ee5d4a6334f70cf69a ]

For such a file mapping,

[0-4k][hole][8k-12k]

In NO_HOLES mode, we don't have the [hole] extent any more.
Commit c1aa45759e90 ("Btrfs: fix shrinking truncate when the no_holes feature is enabled")
 fixed disk isize not being updated in NO_HOLES mode when data is not flushed.

However, even if data has been flushed, we can still have trouble
in updating disk isize since we updated disk isize to 'start' of
the last evicted extent.

Reviewed-by: Chris Mason <clm@fb.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/inode.c