On Thu, Feb 06, 2025 at 03:31:02PM +0100, Greg Kroah-Hartman wrote: > On Thu, Feb 06, 2025 at 08:41:33PM +0900, Koichiro Den wrote: > > On Mon, Dec 30, 2024 at 04:43:39PM GMT, Greg Kroah-Hartman wrote: > > > > > > > Hi, please let me confirm; is this backport really ok? I mean, should the > > cond_resched() be added to btrfs_swap_activate() loop? I was able to > > reproduce the same situation: > > > > $ git rev-parse HEAD > > 319addc2ad901dac4d6cc931d77ef35073e0942f > > $ b4 mbox --single-message c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@xxxxxxxx > > 1 messages in the thread > > Saved ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@xxxxxxxxxxxx > > $ patch -p1 < ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@xxxxxxxxxxxx > > patching file fs/btrfs/inode.c > > Hunk #1 succeeded at 7117 with fuzz 1 (offset -2961 lines). > > $ git diff > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > > index 58ffe78132d9..6fe2ac620464 100644 > > --- a/fs/btrfs/inode.c > > +++ b/fs/btrfs/inode.c > > @@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len, > > ret = -EAGAIN; > > goto out; > > } > > + > > + cond_resched(); > > } > > > > if (file_extent) > > > > The same goes for all the other stable branches applied. Sorry if I'm > > missing something. > > Hm, looks like patch messed this up :( The fix is part of 4 patch series. The stable tree 6.12 has only 3 and in different order, so this one fails to apply due to missing context and got applied to the wrong function. Applying all 4 in order to 6.12.y (same base commit f6279a98db132da0cff) works without conflicts. $ git cherry-pick 0525064bb82e50d59543b62b9d41a606198a4a44 Auto-merging fs/btrfs/inode.c [detached HEAD 0466e0dbbb99] btrfs: fix race with memory mapped writes when activating swap file Author: Filipe Manana <fdmanana@xxxxxxxx> Date: Fri Nov 29 12:25:30 2024 +0000 1 file changed, 24 insertions(+), 7 deletions(-) $ git cherry-pick 03018e5d8508254534511d40fb57bc150e6a87f2 Auto-merging fs/btrfs/inode.c [detached HEAD 1715e6abcf46] btrfs: fix swap file activation failure due to extents that used to be shared Author: Filipe Manana <fdmanana@xxxxxxxx> Date: Mon Dec 9 12:54:14 2024 +0000 1 file changed, 69 insertions(+), 27 deletions(-) $ git cherry-pick 9a45022a0efadd99bcc58f7f1cc2b6fb3b808c40 Auto-merging fs/btrfs/inode.c [detached HEAD 78d50f8c8827] btrfs: allow swap activation to be interruptible Author: Filipe Manana <fdmanana@xxxxxxxx> Date: Mon Dec 9 16:31:41 2024 +0000 1 file changed, 5 insertions(+) $ git cherry-pick 2c8507c63f5498d4ee4af404a8e44ceae4345056 Auto-merging fs/btrfs/inode.c [detached HEAD a162d2371965] btrfs: avoid monopolizing a core when activating a swap file Author: Filipe Manana <fdmanana@xxxxxxxx> Date: Mon Dec 9 16:43:44 2024 +0000 1 file changed, 2 insertions(+) I have more trust in git patch logic than 'patch', this can happen in the future again.