Re: [PATCH] btrfs: Fix possible softlock on single core machines

2018-04-08 Thread Sasha Levin
Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 6d74119f1a3e Btrfs: avoid taking the chunk_mutex in 
do_chunk_alloc.

The bot has also determined it's probably a bug fixing patch. (score: 55.2868)

The bot has tested the following trees: v4.16, v4.15.15, v4.14.32, v4.9.92, 
v4.4.126.

v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

--
Thanks,
Sasha--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] btrfs: Fix possible softlock on single core machines

2018-04-05 Thread David Sterba
On Thu, Apr 05, 2018 at 06:04:12PM +0300, Nikolay Borisov wrote:
> 
> 
> On  5.04.2018 16:55, David Sterba wrote:
> > On Thu, Apr 05, 2018 at 10:40:15AM +0300, Nikolay Borisov wrote:
> >> do_chunk_alloc implements a loop checking whether there is a pending
> >> chunk allocation and if so causes the caller do loop. Generally this
> >> loop is executed only once, however testing with btrfs/072 on a
> >> single core vm machines uncovered an extreme case where the system
> >> could loop indefinitely. This is due to a missing cond_resched when
> >> loop which doesn't give a chance to the previous chunk allocator finish
> >> its job.
> >>
> >> The fix is to simply add the missing cond_resched.
> >>
> >> Fixes: 6d74119f1a3e ("Btrfs: avoid taking the chunk_mutex in 
> >> do_chunk_alloc")
> > 
> > Does this commit really lead to the endless loop on UP? I don't see any
> > obvious connection.
> 
> This is the commit that introduced the loop there without adding
> cond_resched, hence the fixes tag.

Makes sense, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] btrfs: Fix possible softlock on single core machines

2018-04-05 Thread Nikolay Borisov


On  5.04.2018 16:55, David Sterba wrote:
> On Thu, Apr 05, 2018 at 10:40:15AM +0300, Nikolay Borisov wrote:
>> do_chunk_alloc implements a loop checking whether there is a pending
>> chunk allocation and if so causes the caller do loop. Generally this
>> loop is executed only once, however testing with btrfs/072 on a
>> single core vm machines uncovered an extreme case where the system
>> could loop indefinitely. This is due to a missing cond_resched when
>> loop which doesn't give a chance to the previous chunk allocator finish
>> its job.
>>
>> The fix is to simply add the missing cond_resched.
>>
>> Fixes: 6d74119f1a3e ("Btrfs: avoid taking the chunk_mutex in do_chunk_alloc")
> 
> Does this commit really lead to the endless loop on UP? I don't see any
> obvious connection.

This is the commit that introduced the loop there without adding
cond_resched, hence the fixes tag.
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] btrfs: Fix possible softlock on single core machines

2018-04-05 Thread David Sterba
On Thu, Apr 05, 2018 at 10:40:15AM +0300, Nikolay Borisov wrote:
> do_chunk_alloc implements a loop checking whether there is a pending
> chunk allocation and if so causes the caller do loop. Generally this
> loop is executed only once, however testing with btrfs/072 on a
> single core vm machines uncovered an extreme case where the system
> could loop indefinitely. This is due to a missing cond_resched when
> loop which doesn't give a chance to the previous chunk allocator finish
> its job.
> 
> The fix is to simply add the missing cond_resched.
> 
> Fixes: 6d74119f1a3e ("Btrfs: avoid taking the chunk_mutex in do_chunk_alloc")

Does this commit really lead to the endless loop on UP? I don't see any
obvious connection.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] btrfs: Fix possible softlock on single core machines

2018-04-05 Thread Nikolay Borisov
do_chunk_alloc implements a loop checking whether there is a pending
chunk allocation and if so causes the caller do loop. Generally this
loop is executed only once, however testing with btrfs/072 on a
single core vm machines uncovered an extreme case where the system
could loop indefinitely. This is due to a missing cond_resched when
loop which doesn't give a chance to the previous chunk allocator finish
its job.

The fix is to simply add the missing cond_resched.

Fixes: 6d74119f1a3e ("Btrfs: avoid taking the chunk_mutex in do_chunk_alloc")
Signed-off-by: Nikolay Borisov 
---
 fs/btrfs/extent-tree.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 0cf1d4c518e9..070227b78d4e 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4645,6 +4645,7 @@ static int do_chunk_alloc(struct btrfs_trans_handle 
*trans,
if (wait_for_alloc) {
mutex_unlock(&fs_info->chunk_mutex);
wait_for_alloc = 0;
+   cond_resched();
goto again;
}
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html