Re: [PATCH 1/2] Btrfs: fix missing inode i_size update after zero range operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 18, 2018 at 11:34:20AM +0000, fdmanana@xxxxxxxxxx wrote:
> From: Filipe Manana <fdmanana@xxxxxxxx>
> 
> For a fallocate's zero range operation that targets a range with an end
> that is not aligned to the sector size, we can end up not updating the
> inode's i_size. This happens when the last page of the range maps to an
> unwritten (prealloc) extent and before that last page we have either a
> hole or a written extent. This is because in this scenario we relied
> on a call to btrfs_prealloc_file_range() to update the inode's i_size,
> however it can only update the i_size to the "down aligned" end of the
> range.
> 
> Example:
> 
>  $ mkfs.btrfs -f /dev/sdc
>  $ mount /dev/sdc /mnt
>  $ xfs_io -f -c "pwrite -S 0xff 0 428K" /mnt/foobar
>  $ xfs_io -c "falloc -k 428K 4K" /mnt/foobar
>  $ xfs_io -c "fzero 0 430K" /mnt/foobar
>  $ du --bytes /mnt/foobar
>  438272	/mnt/foobar
> 
> The inode's i_size was left as 428Kb (438272 bytes) when it should have
> been updated to 430Kb (440320 bytes).
> Fix this by always updating the inode's i_size explicitly after zeroing
> the range.
> 
> Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>

Added to 4.16 queue, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux