* [PATCH] Btrfs: fix RCU correctness warning when running sanity tests
@ 2014-06-10 18:12 Filipe David Borba Manana
2014-06-10 18:17 ` [PATCH v2] " Filipe David Borba Manana
0 siblings, 1 reply; 4+ messages in thread
From: Filipe David Borba Manana @ 2014-06-10 18:12 UTC (permalink / raw)
To: linux-btrfs; +Cc: Filipe David Borba Manana
When CONFIG_PROVE_RCU=y and CONFIG_PROVE_RCU_REPEATEDLY=y, the
following was dumped in dmesg:
[ 3197.218064] ===============================
[ 3197.218064] [ INFO: suspicious RCU usage. ]
[ 3197.218066] 3.15.0-rc8-fdm-btrfs-next-33+ #4 Not tainted
[ 3197.218067] -------------------------------
[ 3197.218068] include/linux/radix-tree.h:196 suspicious rcu_dereference_check() usage!
[ 3197.218068]
[ 3197.218068] other info that might help us debug this:
[ 3197.218068]
[ 3197.218070]
[ 3197.218070] rcu_scheduler_active = 1, debug_locks = 1
[ 3197.218071] 1 lock held by modprobe/12024:
[ 3197.218072] #0: (&(&fs_info->buffer_lock)->rlock){+.+...}, at: [<ffffffffa025c5fa>] btrfs_free_dummy_root+0x5a/0x1d0 [btrfs]
[ 3197.218093]
[ 3197.218093] stack backtrace:
[ 3197.218095] CPU: 3 PID: 12024 Comm: modprobe Not tainted 3.15.0-rc8-fdm-btrfs-next-33+ #4
[ 3197.218096] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 3197.218097] 0000000000000001 ffff8800af18fc18 ffffffff81685c5a 000000000000feb0
[ 3197.218099] ffff8800cf6ccb40 ffff8800af18fc48 ffffffff810a6316 ffff8801d955f640
[ 3197.218101] ffff8800d719e328 ffff8800d719e370 ffff8800d719c000 ffff8800af18fcb8
[ 3197.218102] Call Trace:
[ 3197.218105] [<ffffffff81685c5a>] dump_stack+0x4e/0x68
[ 3197.218108] [<ffffffff810a6316>] lockdep_rcu_suspicious+0xe6/0x130
[ 3197.218119] [<ffffffffa025c728>] btrfs_free_dummy_root+0x188/0x1d0 [btrfs]
[ 3197.218129] [<ffffffffa025f56a>] btrfs_test_qgroups+0xea/0x1bb [btrfs]
[ 3197.218137] [<ffffffffa03a19d2>] ? ftrace_define_fields_btrfs_space_reservation+0xfd/0xfd [btrfs]
[ 3197.218144] [<ffffffffa03a19d2>] ? ftrace_define_fields_btrfs_space_reservation+0xfd/0xfd [btrfs]
[ 3197.218151] [<ffffffffa03a1ab7>] init_btrfs_fs+0xe5/0x184 [btrfs]
[ 3197.218154] [<ffffffff81000352>] do_one_initcall+0x102/0x150
[ 3197.218157] [<ffffffff8103d223>] ? set_memory_nx+0x43/0x50
[ 3197.218160] [<ffffffff81682668>] ? set_section_ro_nx+0x6d/0x74
[ 3197.218162] [<ffffffff810d91cc>] load_module+0x1cdc/0x2630
[ 3197.218164] [<ffffffff810d4e90>] ? show_initstate+0x60/0x60
[ 3197.218166] [<ffffffff810d9c9e>] SyS_finit_module+0x8e/0x90
[ 3197.218168] [<ffffffff81698212>] system_call_fastpath+0x16/0x1b
Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
---
fs/btrfs/tests/btrfs-tests.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c
index a5dcacb..bbbfec9 100644
--- a/fs/btrfs/tests/btrfs-tests.c
+++ b/fs/btrfs/tests/btrfs-tests.c
@@ -130,8 +130,8 @@ static void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info)
struct radix_tree_iter iter;
void **slot;
- spin_lock(&fs_info->buffer_lock);
restart:
+ rcu_read_lock();
radix_tree_for_each_slot(slot, &fs_info->buffer_radix, &iter, 0) {
struct extent_buffer *eb;
@@ -144,11 +144,11 @@ restart:
goto restart;
continue;
}
- spin_unlock(&fs_info->buffer_lock);
+ rcu_read_unlock();
free_extent_buffer_stale(eb);
- spin_lock(&fs_info->buffer_lock);
+ goto restart;
}
- spin_unlock(&fs_info->buffer_lock);
+ rcu_read_unlock();
btrfs_free_qgroup_config(fs_info);
btrfs_free_fs_roots(fs_info);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] Btrfs: fix RCU correctness warning when running sanity tests
2014-06-10 18:12 [PATCH] Btrfs: fix RCU correctness warning when running sanity tests Filipe David Borba Manana
@ 2014-06-10 18:17 ` Filipe David Borba Manana
2014-06-13 9:09 ` Filipe David Manana
0 siblings, 1 reply; 4+ messages in thread
From: Filipe David Borba Manana @ 2014-06-10 18:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: Filipe David Borba Manana
When CONFIG_PROVE_RCU=y and CONFIG_PROVE_RCU_REPEATEDLY=y, the
following was dumped in dmesg:
[ 3197.218064] ===============================
[ 3197.218064] [ INFO: suspicious RCU usage. ]
[ 3197.218066] 3.15.0-rc8-fdm-btrfs-next-33+ #4 Not tainted
[ 3197.218067] -------------------------------
[ 3197.218068] include/linux/radix-tree.h:196 suspicious rcu_dereference_check() usage!
[ 3197.218068]
[ 3197.218068] other info that might help us debug this:
[ 3197.218068]
[ 3197.218070]
[ 3197.218070] rcu_scheduler_active = 1, debug_locks = 1
[ 3197.218071] 1 lock held by modprobe/12024:
[ 3197.218072] #0: (&(&fs_info->buffer_lock)->rlock){+.+...}, at: [<ffffffffa025c5fa>] btrfs_free_dummy_root+0x5a/0x1d0 [btrfs]
[ 3197.218093]
[ 3197.218093] stack backtrace:
[ 3197.218095] CPU: 3 PID: 12024 Comm: modprobe Not tainted 3.15.0-rc8-fdm-btrfs-next-33+ #4
[ 3197.218096] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 3197.218097] 0000000000000001 ffff8800af18fc18 ffffffff81685c5a 000000000000feb0
[ 3197.218099] ffff8800cf6ccb40 ffff8800af18fc48 ffffffff810a6316 ffff8801d955f640
[ 3197.218101] ffff8800d719e328 ffff8800d719e370 ffff8800d719c000 ffff8800af18fcb8
[ 3197.218102] Call Trace:
[ 3197.218105] [<ffffffff81685c5a>] dump_stack+0x4e/0x68
[ 3197.218108] [<ffffffff810a6316>] lockdep_rcu_suspicious+0xe6/0x130
[ 3197.218119] [<ffffffffa025c728>] btrfs_free_dummy_root+0x188/0x1d0 [btrfs]
[ 3197.218129] [<ffffffffa025f56a>] btrfs_test_qgroups+0xea/0x1bb [btrfs]
[ 3197.218137] [<ffffffffa03a19d2>] ? ftrace_define_fields_btrfs_space_reservation+0xfd/0xfd [btrfs]
[ 3197.218144] [<ffffffffa03a19d2>] ? ftrace_define_fields_btrfs_space_reservation+0xfd/0xfd [btrfs]
[ 3197.218151] [<ffffffffa03a1ab7>] init_btrfs_fs+0xe5/0x184 [btrfs]
[ 3197.218154] [<ffffffff81000352>] do_one_initcall+0x102/0x150
[ 3197.218157] [<ffffffff8103d223>] ? set_memory_nx+0x43/0x50
[ 3197.218160] [<ffffffff81682668>] ? set_section_ro_nx+0x6d/0x74
[ 3197.218162] [<ffffffff810d91cc>] load_module+0x1cdc/0x2630
[ 3197.218164] [<ffffffff810d4e90>] ? show_initstate+0x60/0x60
[ 3197.218166] [<ffffffff810d9c9e>] SyS_finit_module+0x8e/0x90
[ 3197.218168] [<ffffffff81698212>] system_call_fastpath+0x16/0x1b
Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
---
V2: Added missing rcu read unlock if a retry is needed.
fs/btrfs/tests/btrfs-tests.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c
index a5dcacb..bdb1f05 100644
--- a/fs/btrfs/tests/btrfs-tests.c
+++ b/fs/btrfs/tests/btrfs-tests.c
@@ -130,8 +130,8 @@ static void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info)
struct radix_tree_iter iter;
void **slot;
- spin_lock(&fs_info->buffer_lock);
restart:
+ rcu_read_lock();
radix_tree_for_each_slot(slot, &fs_info->buffer_radix, &iter, 0) {
struct extent_buffer *eb;
@@ -140,15 +140,17 @@ restart:
continue;
/* Shouldn't happen but that kind of thinking creates CVE's */
if (radix_tree_exception(eb)) {
- if (radix_tree_deref_retry(eb))
+ if (radix_tree_deref_retry(eb)) {
+ rcu_read_unlock();
goto restart;
+ }
continue;
}
- spin_unlock(&fs_info->buffer_lock);
+ rcu_read_unlock();
free_extent_buffer_stale(eb);
- spin_lock(&fs_info->buffer_lock);
+ goto restart;
}
- spin_unlock(&fs_info->buffer_lock);
+ rcu_read_unlock();
btrfs_free_qgroup_config(fs_info);
btrfs_free_fs_roots(fs_info);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] Btrfs: fix RCU correctness warning when running sanity tests
2014-06-10 18:17 ` [PATCH v2] " Filipe David Borba Manana
@ 2014-06-13 9:09 ` Filipe David Manana
2014-06-13 14:12 ` Chris Mason
0 siblings, 1 reply; 4+ messages in thread
From: Filipe David Manana @ 2014-06-13 9:09 UTC (permalink / raw)
To: linux-btrfs@vger.kernel.org; +Cc: Filipe David Borba Manana, Chris Mason
On Tue, Jun 10, 2014 at 7:17 PM, Filipe David Borba Manana
<fdmanana@gmail.com> wrote:
> When CONFIG_PROVE_RCU=y and CONFIG_PROVE_RCU_REPEATEDLY=y, the
> following was dumped in dmesg:
>
> [ 3197.218064] ===============================
> [ 3197.218064] [ INFO: suspicious RCU usage. ]
> [ 3197.218066] 3.15.0-rc8-fdm-btrfs-next-33+ #4 Not tainted
> [ 3197.218067] -------------------------------
> [ 3197.218068] include/linux/radix-tree.h:196 suspicious rcu_dereference_check() usage!
> [ 3197.218068]
> [ 3197.218068] other info that might help us debug this:
> [ 3197.218068]
> [ 3197.218070]
> [ 3197.218070] rcu_scheduler_active = 1, debug_locks = 1
> [ 3197.218071] 1 lock held by modprobe/12024:
> [ 3197.218072] #0: (&(&fs_info->buffer_lock)->rlock){+.+...}, at: [<ffffffffa025c5fa>] btrfs_free_dummy_root+0x5a/0x1d0 [btrfs]
> [ 3197.218093]
> [ 3197.218093] stack backtrace:
> [ 3197.218095] CPU: 3 PID: 12024 Comm: modprobe Not tainted 3.15.0-rc8-fdm-btrfs-next-33+ #4
> [ 3197.218096] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> [ 3197.218097] 0000000000000001 ffff8800af18fc18 ffffffff81685c5a 000000000000feb0
> [ 3197.218099] ffff8800cf6ccb40 ffff8800af18fc48 ffffffff810a6316 ffff8801d955f640
> [ 3197.218101] ffff8800d719e328 ffff8800d719e370 ffff8800d719c000 ffff8800af18fcb8
> [ 3197.218102] Call Trace:
> [ 3197.218105] [<ffffffff81685c5a>] dump_stack+0x4e/0x68
> [ 3197.218108] [<ffffffff810a6316>] lockdep_rcu_suspicious+0xe6/0x130
> [ 3197.218119] [<ffffffffa025c728>] btrfs_free_dummy_root+0x188/0x1d0 [btrfs]
> [ 3197.218129] [<ffffffffa025f56a>] btrfs_test_qgroups+0xea/0x1bb [btrfs]
> [ 3197.218137] [<ffffffffa03a19d2>] ? ftrace_define_fields_btrfs_space_reservation+0xfd/0xfd [btrfs]
> [ 3197.218144] [<ffffffffa03a19d2>] ? ftrace_define_fields_btrfs_space_reservation+0xfd/0xfd [btrfs]
> [ 3197.218151] [<ffffffffa03a1ab7>] init_btrfs_fs+0xe5/0x184 [btrfs]
> [ 3197.218154] [<ffffffff81000352>] do_one_initcall+0x102/0x150
> [ 3197.218157] [<ffffffff8103d223>] ? set_memory_nx+0x43/0x50
> [ 3197.218160] [<ffffffff81682668>] ? set_section_ro_nx+0x6d/0x74
> [ 3197.218162] [<ffffffff810d91cc>] load_module+0x1cdc/0x2630
> [ 3197.218164] [<ffffffff810d4e90>] ? show_initstate+0x60/0x60
> [ 3197.218166] [<ffffffff810d9c9e>] SyS_finit_module+0x8e/0x90
> [ 3197.218168] [<ffffffff81698212>] system_call_fastpath+0x16/0x1b
>
> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Chris,
Please drop this patch from your integration branch.
Sasha fixed this too but in a simpler way:
https://patchwork.kernel.org/patch/4337091/
(In fact both patches applied probably trigger another warning the rcu
usage correctness checker)
Thanks
> ---
>
> V2: Added missing rcu read unlock if a retry is needed.
>
> fs/btrfs/tests/btrfs-tests.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c
> index a5dcacb..bdb1f05 100644
> --- a/fs/btrfs/tests/btrfs-tests.c
> +++ b/fs/btrfs/tests/btrfs-tests.c
> @@ -130,8 +130,8 @@ static void btrfs_free_dummy_fs_info(struct btrfs_fs_info *fs_info)
> struct radix_tree_iter iter;
> void **slot;
>
> - spin_lock(&fs_info->buffer_lock);
> restart:
> + rcu_read_lock();
> radix_tree_for_each_slot(slot, &fs_info->buffer_radix, &iter, 0) {
> struct extent_buffer *eb;
>
> @@ -140,15 +140,17 @@ restart:
> continue;
> /* Shouldn't happen but that kind of thinking creates CVE's */
> if (radix_tree_exception(eb)) {
> - if (radix_tree_deref_retry(eb))
> + if (radix_tree_deref_retry(eb)) {
> + rcu_read_unlock();
> goto restart;
> + }
> continue;
> }
> - spin_unlock(&fs_info->buffer_lock);
> + rcu_read_unlock();
> free_extent_buffer_stale(eb);
> - spin_lock(&fs_info->buffer_lock);
> + goto restart;
> }
> - spin_unlock(&fs_info->buffer_lock);
> + rcu_read_unlock();
>
> btrfs_free_qgroup_config(fs_info);
> btrfs_free_fs_roots(fs_info);
> --
> 1.9.1
>
--
Filipe David Manana,
"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] Btrfs: fix RCU correctness warning when running sanity tests
2014-06-13 9:09 ` Filipe David Manana
@ 2014-06-13 14:12 ` Chris Mason
0 siblings, 0 replies; 4+ messages in thread
From: Chris Mason @ 2014-06-13 14:12 UTC (permalink / raw)
To: fdmanana, linux-btrfs@vger.kernel.org
On 06/13/2014 05:09 AM, Filipe David Manana wrote:
> On Tue, Jun 10, 2014 at 7:17 PM, Filipe David Borba Manana
> <fdmanana@gmail.com> wrote:
>> When CONFIG_PROVE_RCU=y and CONFIG_PROVE_RCU_REPEATEDLY=y, the
>> following was dumped in dmesg:
>>
>> [ 3197.218064] ===============================
>> [ 3197.218064] [ INFO: suspicious RCU usage. ]
>> [ 3197.218066] 3.15.0-rc8-fdm-btrfs-next-33+ #4 Not tainted
>> [ 3197.218067] -------------------------------
>> [ 3197.218068] include/linux/radix-tree.h:196 suspicious rcu_dereference_check() usage!
>> [ 3197.218068]
>> [ 3197.218068] other info that might help us debug this:
>> [ 3197.218068]
>> [ 3197.218070]
>> [ 3197.218070] rcu_scheduler_active = 1, debug_locks = 1
>> [ 3197.218071] 1 lock held by modprobe/12024:
>> [ 3197.218072] #0: (&(&fs_info->buffer_lock)->rlock){+.+...}, at: [<ffffffffa025c5fa>] btrfs_free_dummy_root+0x5a/0x1d0 [btrfs]
>> [ 3197.218093]
>> [ 3197.218093] stack backtrace:
>> [ 3197.218095] CPU: 3 PID: 12024 Comm: modprobe Not tainted 3.15.0-rc8-fdm-btrfs-next-33+ #4
>> [ 3197.218096] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
>> [ 3197.218097] 0000000000000001 ffff8800af18fc18 ffffffff81685c5a 000000000000feb0
>> [ 3197.218099] ffff8800cf6ccb40 ffff8800af18fc48 ffffffff810a6316 ffff8801d955f640
>> [ 3197.218101] ffff8800d719e328 ffff8800d719e370 ffff8800d719c000 ffff8800af18fcb8
>> [ 3197.218102] Call Trace:
>> [ 3197.218105] [<ffffffff81685c5a>] dump_stack+0x4e/0x68
>> [ 3197.218108] [<ffffffff810a6316>] lockdep_rcu_suspicious+0xe6/0x130
>> [ 3197.218119] [<ffffffffa025c728>] btrfs_free_dummy_root+0x188/0x1d0 [btrfs]
>> [ 3197.218129] [<ffffffffa025f56a>] btrfs_test_qgroups+0xea/0x1bb [btrfs]
>> [ 3197.218137] [<ffffffffa03a19d2>] ? ftrace_define_fields_btrfs_space_reservation+0xfd/0xfd [btrfs]
>> [ 3197.218144] [<ffffffffa03a19d2>] ? ftrace_define_fields_btrfs_space_reservation+0xfd/0xfd [btrfs]
>> [ 3197.218151] [<ffffffffa03a1ab7>] init_btrfs_fs+0xe5/0x184 [btrfs]
>> [ 3197.218154] [<ffffffff81000352>] do_one_initcall+0x102/0x150
>> [ 3197.218157] [<ffffffff8103d223>] ? set_memory_nx+0x43/0x50
>> [ 3197.218160] [<ffffffff81682668>] ? set_section_ro_nx+0x6d/0x74
>> [ 3197.218162] [<ffffffff810d91cc>] load_module+0x1cdc/0x2630
>> [ 3197.218164] [<ffffffff810d4e90>] ? show_initstate+0x60/0x60
>> [ 3197.218166] [<ffffffff810d9c9e>] SyS_finit_module+0x8e/0x90
>> [ 3197.218168] [<ffffffff81698212>] system_call_fastpath+0x16/0x1b
>>
>> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
>
> Chris,
>
> Please drop this patch from your integration branch.
> Sasha fixed this too but in a simpler way:
> https://urldefense.proofpoint.com/v1/url?u=https://patchwork.kernel.org/patch/4337091/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=6%2FL0lzzDhu0Y1hL9xm%2BQyA%3D%3D%0A&m=udAT%2BO62eFj7qxpld6pYEp%2FRKmeGPjqGP8i%2Fb8%2FcJ2s%3D%0A&s=e3bbde8e6b7bd327f6f32a8f959089bed8f4a25a27fa8b0ddf2589cf70b8a89f
> (In fact both patches applied probably trigger another warning the rcu
Thanks, it did look overlapping to me, was going to sort it out in the
morning.
-chris
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-13 14:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-10 18:12 [PATCH] Btrfs: fix RCU correctness warning when running sanity tests Filipe David Borba Manana
2014-06-10 18:17 ` [PATCH v2] " Filipe David Borba Manana
2014-06-13 9:09 ` Filipe David Manana
2014-06-13 14:12 ` Chris Mason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).