On Thu, Jan 12, 2017 at 08:13:26AM -0800, Liu Bo wrote: > btrfs_ordered_update_i_size can be called by truncate and endio, but only endio > takes ordered_extent which contains the completed IO. > > while truncating down a file, if there are some in-flight IOs, > btrfs_ordered_update_i_size in endio will set disk_i_size to @orig_offset that > is zero. If truncating-down fails somehow, we try to recover in memory isize > with this zero'd disk_i_size. > > Fix it by only updating disk_i_size with @orig_offset when > btrfs_ordered_update_i_size is not called from endio while truncating down and > waiting for in-flight IOs completing their work before recover in-memory size. > > Besides fixing the above issue, add an assertion for last_size to double check > we truncate down to the desired size. > > Signed-off-by: Liu Bo <bo.li.liu@xxxxxxxxxx> Looks good to me, added to 4.11 queue. -- 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
