On Fri, Dec 13, 2019 at 12:12:57PM -0500, Brian Foster wrote: > The insert range operation uses a unique transaction and ilock cycle > for the extent split and each extent shift iteration of the overall > operation. While this works, it is risks racing with other > operations in subtle ways such as COW writeback modifying an extent > tree in the middle of a shift operation. > > To avoid this problem, make insert range atomic with respect to > ilock. Hold the ilock across the entire operation, replace the > individual transactions with a single rolling transaction sequence > and relog the inode to keep it moving in the log. This guarantees > that nothing else can change the extent mapping of an inode while > an insert range operation is in progress. This looks good, and similar to our usual truncate sequence: Reviewed-by: Christoph Hellwig <hch@xxxxxx>