diff options
author | Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> | 2018-08-23 22:35:28 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-08-24 08:09:43 -0400 |
commit | b6fdfbff078975c53383fc146a2a54985eab6b6d (patch) | |
tree | 325b31756fd29ed4f2a38f3e74ee5c07829edb98 | |
parent | b9b8a41adeff5666b402996020b698504c927353 (diff) |
btrfs: Fix suspicious RCU usage warning in btrfs_debug_in_rcu
Commit 672d599041c8 ("btrfs: Use wrapper macro for rcu string to remove
duplicate code") replaces some open coded RCU string handling with macro.
It turns out that btrfs_debug_in_rcu() is used for the first time and
the macro lacks lock/unlock of RCU string for non-debug case (i.e. when
the message is not printed), leading to suspicious RCU usage warning
when CONFIG_PROVE_RCU is on.
Fix this by adding a wrapper to call lock/unlock for the non-debug case
too.
Fixes: 672d599041c8 ("btrfs: Use wrapper macro for rcu string to remove duplicate code")
Reported-by: David Howells <dhowells@redhat.com>
Tested-by: David Howells <dhowells@redhat.com>
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/ctree.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index a67cc190a84b..0b856da2fd3b 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3390,9 +3390,9 @@ do { \ | |||
3390 | #define btrfs_debug(fs_info, fmt, args...) \ | 3390 | #define btrfs_debug(fs_info, fmt, args...) \ |
3391 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) | 3391 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) |
3392 | #define btrfs_debug_in_rcu(fs_info, fmt, args...) \ | 3392 | #define btrfs_debug_in_rcu(fs_info, fmt, args...) \ |
3393 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) | 3393 | btrfs_no_printk_in_rcu(fs_info, KERN_DEBUG fmt, ##args) |
3394 | #define btrfs_debug_rl_in_rcu(fs_info, fmt, args...) \ | 3394 | #define btrfs_debug_rl_in_rcu(fs_info, fmt, args...) \ |
3395 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) | 3395 | btrfs_no_printk_in_rcu(fs_info, KERN_DEBUG fmt, ##args) |
3396 | #define btrfs_debug_rl(fs_info, fmt, args...) \ | 3396 | #define btrfs_debug_rl(fs_info, fmt, args...) \ |
3397 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) | 3397 | btrfs_no_printk(fs_info, KERN_DEBUG fmt, ##args) |
3398 | #endif | 3398 | #endif |
@@ -3404,6 +3404,13 @@ do { \ | |||
3404 | rcu_read_unlock(); \ | 3404 | rcu_read_unlock(); \ |
3405 | } while (0) | 3405 | } while (0) |
3406 | 3406 | ||
3407 | #define btrfs_no_printk_in_rcu(fs_info, fmt, args...) \ | ||
3408 | do { \ | ||
3409 | rcu_read_lock(); \ | ||
3410 | btrfs_no_printk(fs_info, fmt, ##args); \ | ||
3411 | rcu_read_unlock(); \ | ||
3412 | } while (0) | ||
3413 | |||
3407 | #define btrfs_printk_ratelimited(fs_info, fmt, args...) \ | 3414 | #define btrfs_printk_ratelimited(fs_info, fmt, args...) \ |
3408 | do { \ | 3415 | do { \ |
3409 | static DEFINE_RATELIMIT_STATE(_rs, \ | 3416 | static DEFINE_RATELIMIT_STATE(_rs, \ |