summaryrefslogtreecommitdiffstats
path: root/fs/iomap
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-11-01 07:45:00 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2024-11-01 07:45:00 -1000
commit17fa6a5f93fcd5dd936e07aee61c014d401df4ae (patch)
tree46c33e7c4ddf9f7506bcbc1c238b47144fbcd510 /fs/iomap
parentd56239a82e3721d38ff5496f2411bf0cb57ece5c (diff)
parent6db388585e486c0261aeef55f8bc63a9b45756c0 (diff)
downloadlinux-stable-17fa6a5f93fcd5dd936e07aee61c014d401df4ae.tar.gz
linux-stable-17fa6a5f93fcd5dd936e07aee61c014d401df4ae.tar.bz2
linux-stable-17fa6a5f93fcd5dd936e07aee61c014d401df4ae.zip
Merge tag 'vfs-6.12-rc6.iomap' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs
Pull iomap fixes from Christian Brauner: "Fixes for iomap to prevent data corruption bugs in the fallocate unshare range implementation of fsdax and a small cleanup to turn iomap_want_unshare_iter() into an inline function" * tag 'vfs-6.12-rc6.iomap' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs: iomap: turn iomap_want_unshare_iter into an inline function fsdax: dax_unshare_iter needs to copy entire blocks fsdax: remove zeroing code from dax_unshare_iter iomap: share iomap_unshare_iter predicate code with fsdax xfs: don't allocate COW extents when unsharing a hole
Diffstat (limited to 'fs/iomap')
-rw-r--r--fs/iomap/buffered-io.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index aa587b2142e2..ef0b68bccbb6 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -1277,22 +1277,7 @@ static loff_t iomap_unshare_iter(struct iomap_iter *iter)
loff_t length = iomap_length(iter);
loff_t written = 0;
- /* Don't bother with blocks that are not shared to start with. */
- if (!(iomap->flags & IOMAP_F_SHARED))
- return length;
-
- /*
- * Don't bother with delalloc reservations, holes or unwritten extents.
- *
- * Note that we use srcmap directly instead of iomap_iter_srcmap as
- * unsharing requires providing a separate source map, and the presence
- * of one is a good indicator that unsharing is needed, unlike
- * IOMAP_F_SHARED which can be set for any data that goes into the COW
- * fork for XFS.
- */
- if (iter->srcmap.type == IOMAP_HOLE ||
- iter->srcmap.type == IOMAP_DELALLOC ||
- iter->srcmap.type == IOMAP_UNWRITTEN)
+ if (!iomap_want_unshare_iter(iter))
return length;
do {