diff options
| author | Filipe Manana <fdmanana@suse.com> | 2026-01-09 15:09:18 +0300 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-02-03 09:51:43 +0300 |
| commit | 8ecf596ed822d481d1ad0bb589a7d5b9a7e82898 (patch) | |
| tree | e5e94b25d3f3d4f68dab10ffadf2f19b99cf1883 | |
| parent | ae23fee41b36a39f8e163580fe273ca3f88f2413 (diff) | |
| download | linux-8ecf596ed822d481d1ad0bb589a7d5b9a7e82898.tar.xz | |
btrfs: update comment for delalloc flush and oe wait in btrfs_clone_files()
Make the comment more detailed about why we need to flush delalloc and
wait for ordered extent completion before attempting to invalidate the
page cache.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
| -rw-r--r-- | fs/btrfs/reflink.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c index ab4ce56d69ee..314cb95ba846 100644 --- a/fs/btrfs/reflink.c +++ b/fs/btrfs/reflink.c @@ -754,8 +754,13 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, /* * We may have copied an inline extent into a page of the destination - * range, so wait for writeback to complete before invalidating pages - * from the page cache. This is a rare case. + * range. So flush delalloc and wait for ordered extent completion. + * This is to ensure the invalidation below does not fail, as if for + * example it finds a dirty folio, our folio release callback + * (btrfs_release_folio()) returns false, which makes the invalidation + * return an -EBUSY error. We can't ignore such failures since they + * could come from some range other than the copied inline extent's + * destination range and we have no way to know that. */ ret = btrfs_wait_ordered_range(BTRFS_I(inode), destoff, len); if (ret < 0) |
