]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: rework insert range into an atomic operation
authorBrian Foster <bfoster@redhat.com>
Wed, 26 Oct 2022 06:28:19 +0000 (11:58 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 29 Oct 2022 08:20:32 +0000 (10:20 +0200)
commit6a2bd441712aa4aac338362a12bc50c0858e75fb
treecdfdcb392ff8900059a8e5684b2af1619344e23a
parent4c6c300a71a8815befb107eb94dec05d535c59c7
xfs: rework insert range into an atomic operation

commit 02ed3ac858a927a17611bccb4e25424684801502 upstream.

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>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_bmap_util.c