]> git.ipfire.org Git - people/ms/linux.git/commit - fs/xfs/xfs_bmap_util.c
xfs: rework insert range into an atomic operation
authorBrian Foster <bfoster@redhat.com>
Wed, 26 Feb 2020 17:43:16 +0000 (09:43 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 3 Mar 2020 04:55:51 +0000 (20:55 -0800)
commitdd87f87d87fa4359a54e7b44549742f579e3e805
tree82d6f489959b99636e089094b8081597aa5e497d
parentb73df17e4c5ba977205253fb7ef54267717a3cba
xfs: rework insert range into an atomic operation

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.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_bmap_util.c