diff mbox series

btrfs: reschedule when cloning lots of extents

Message ID 23e7f73a25cea63f33c220c1da3daf62d9ffd3e8.1600709608.git.johannes.thumshirn@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs: reschedule when cloning lots of extents | expand

Commit Message

Johannes Thumshirn Sept. 21, 2020, 5:38 p.m. UTC
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(+)

Comments

David Sterba Sept. 21, 2020, 6:28 p.m. UTC | #1
On Tue, Sep 22, 2020 at 02:38:10AM +0900, Johannes Thumshirn wrote:
> 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

It would be better to put relevant parts of the report to the changelog,
the fstests issues are more like a todo list than a long-term bug
tracking tool.
Johannes Thumshirn Sept. 22, 2020, 7:31 a.m. UTC | #2
On 21/09/2020 20:30, David Sterba wrote:
> On Tue, Sep 22, 2020 at 02:38:10AM +0900, Johannes Thumshirn wrote:
>> 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
> 
> It would be better to put relevant parts of the report to the changelog,
> the fstests issues are more like a todo list than a long-term bug
> tracking tool.
> 

OK, I'll add one of the stacktraces here and remove the link in v2.
diff mbox series

Patch

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;