Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: reschedule when cloning lots of extents
@ 2020-09-21 17:38 Johannes Thumshirn
  2020-09-21 18:28 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2020-09-21 17:38 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs, Johannes Thumshirn

We have several occurrences of a soft lockup from generic/175. All of these
lockup reports have the call chain btrfs_clone_files() -> btrfs_clone() in
common.

btrfs_clone_files() calls btrfs_clone() with both source and destination
extents locked and loops over the source extent to create the clones.

Conditionally reschedule in the btrfs_clone() loop, to give some time back
to other processes.

Link: https://github.com/btrfs/fstests/issues/23
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/reflink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
index 39b3269e5760..99aa87c08912 100644
--- a/fs/btrfs/reflink.c
+++ b/fs/btrfs/reflink.c
@@ -520,6 +520,8 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
 			ret = -EINTR;
 			goto out;
 		}
+
+		cond_resched();
 	}
 	ret = 0;
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-22  7:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-21 17:38 [PATCH] btrfs: reschedule when cloning lots of extents Johannes Thumshirn
2020-09-21 18:28 ` David Sterba
2020-09-22  7:31   ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox