* [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add
@ 2018-11-14 7:24 Lu Fengqi
2018-11-14 7:30 ` Nikolay Borisov
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Lu Fengqi @ 2018-11-14 7:24 UTC (permalink / raw)
To: linux-btrfs
=============================
WARNING: suspicious RCU usage
4.20.0-rc2+ #23 Tainted: G O
-----------------------------
fs/btrfs/volumes.c:886 suspicious rcu_dereference_check() usage!
Use btrfs_info_in_rcu instead of pr_info for the required lock/unlock of
RCU string.
Fixes: 1f265fc6f58b ("btrfs: harden agaist duplicate fsid on scanned devices")
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
fs/btrfs/volumes.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 2186300bab91..6039ae5c549e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -873,15 +873,15 @@ static noinline struct btrfs_device *device_list_add(const char *path,
if (device->bdev != path_bdev) {
bdput(path_bdev);
mutex_unlock(&fs_devices->device_list_mutex);
- pr_warn(
- "BTRFS: duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
+ btrfs_warn_in_rcu(device->fs_info,
+ "duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
disk_super->fsid, devid,
rcu_str_deref(device->name), path);
return ERR_PTR(-EEXIST);
}
bdput(path_bdev);
- pr_info(
- "BTRFS: device fsid %pU devid %llu moved old:%s new:%s\n",
+ btrfs_info_in_rcu(device->fs_info,
+ "device fsid %pU devid %llu moved old:%s new:%s\n",
disk_super->fsid, devid,
rcu_str_deref(device->name), path);
}
--
2.19.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add
2018-11-14 7:24 [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add Lu Fengqi
@ 2018-11-14 7:30 ` Nikolay Borisov
2018-11-14 13:19 ` Anand Jain
2018-11-14 16:05 ` David Sterba
2 siblings, 0 replies; 5+ messages in thread
From: Nikolay Borisov @ 2018-11-14 7:30 UTC (permalink / raw)
To: Lu Fengqi, linux-btrfs
On 14.11.18 г. 9:24 ч., Lu Fengqi wrote:
> =============================
> WARNING: suspicious RCU usage
> 4.20.0-rc2+ #23 Tainted: G O
> -----------------------------
> fs/btrfs/volumes.c:886 suspicious rcu_dereference_check() usage!
>
> Use btrfs_info_in_rcu instead of pr_info for the required lock/unlock of
> RCU string.
>
> Fixes: 1f265fc6f58b ("btrfs: harden agaist duplicate fsid on scanned devices")
> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/volumes.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 2186300bab91..6039ae5c549e 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -873,15 +873,15 @@ static noinline struct btrfs_device *device_list_add(const char *path,
> if (device->bdev != path_bdev) {
> bdput(path_bdev);
> mutex_unlock(&fs_devices->device_list_mutex);
> - pr_warn(
> - "BTRFS: duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
> + btrfs_warn_in_rcu(device->fs_info,
> + "duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
> disk_super->fsid, devid,
> rcu_str_deref(device->name), path);
> return ERR_PTR(-EEXIST);
> }
> bdput(path_bdev);
> - pr_info(
> - "BTRFS: device fsid %pU devid %llu moved old:%s new:%s\n",
> + btrfs_info_in_rcu(device->fs_info,
> + "device fsid %pU devid %llu moved old:%s new:%s\n",
> disk_super->fsid, devid,
> rcu_str_deref(device->name), path);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add
2018-11-14 7:24 [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add Lu Fengqi
2018-11-14 7:30 ` Nikolay Borisov
@ 2018-11-14 13:19 ` Anand Jain
2018-11-14 16:05 ` David Sterba
2 siblings, 0 replies; 5+ messages in thread
From: Anand Jain @ 2018-11-14 13:19 UTC (permalink / raw)
To: Lu Fengqi, linux-btrfs
On 11/14/2018 03:24 PM, Lu Fengqi wrote:
> =============================
> WARNING: suspicious RCU usage
> 4.20.0-rc2+ #23 Tainted: G O
> -----------------------------
> fs/btrfs/volumes.c:886 suspicious rcu_dereference_check() usage!
>
> Use btrfs_info_in_rcu instead of pr_info for the required lock/unlock of
> RCU string.
>
> Fixes: 1f265fc6f58b ("btrfs: harden agaist duplicate fsid on scanned devices")
> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Thanks Lu. I missed it.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
> ---
> fs/btrfs/volumes.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 2186300bab91..6039ae5c549e 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -873,15 +873,15 @@ static noinline struct btrfs_device *device_list_add(const char *path,
> if (device->bdev != path_bdev) {
> bdput(path_bdev);
> mutex_unlock(&fs_devices->device_list_mutex);
> - pr_warn(
> - "BTRFS: duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
> + btrfs_warn_in_rcu(device->fs_info,
> + "duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
> disk_super->fsid, devid,
> rcu_str_deref(device->name), path);
> return ERR_PTR(-EEXIST);
> }
> bdput(path_bdev);
> - pr_info(
> - "BTRFS: device fsid %pU devid %llu moved old:%s new:%s\n",
> + btrfs_info_in_rcu(device->fs_info,
> + "device fsid %pU devid %llu moved old:%s new:%s\n",
> disk_super->fsid, devid,
> rcu_str_deref(device->name), path);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add
2018-11-14 7:24 [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add Lu Fengqi
2018-11-14 7:30 ` Nikolay Borisov
2018-11-14 13:19 ` Anand Jain
@ 2018-11-14 16:05 ` David Sterba
2018-11-15 1:21 ` Lu Fengqi
2 siblings, 1 reply; 5+ messages in thread
From: David Sterba @ 2018-11-14 16:05 UTC (permalink / raw)
To: Lu Fengqi; +Cc: linux-btrfs
On Wed, Nov 14, 2018 at 03:24:56PM +0800, Lu Fengqi wrote:
> =============================
> WARNING: suspicious RCU usage
> 4.20.0-rc2+ #23 Tainted: G O
> -----------------------------
> fs/btrfs/volumes.c:886 suspicious rcu_dereference_check() usage!
>
> Use btrfs_info_in_rcu instead of pr_info for the required lock/unlock of
> RCU string.
>
> Fixes: 1f265fc6f58b ("btrfs: harden agaist duplicate fsid on scanned devices")
Thanks for the fix.
Please note that the patch is still in the devel queue (misc-next) so
the commit id is unstable, and such fixups get folded to the patch.
You may also reply to the original mail with patch, but sending a bare
code change without a full changelog is also fine if the original patch
was sent long time ago and the fixup could get lost.
> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
> ---
> fs/btrfs/volumes.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 2186300bab91..6039ae5c549e 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -873,15 +873,15 @@ static noinline struct btrfs_device *device_list_add(const char *path,
> if (device->bdev != path_bdev) {
> bdput(path_bdev);
> mutex_unlock(&fs_devices->device_list_mutex);
> - pr_warn(
> - "BTRFS: duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
> + btrfs_warn_in_rcu(device->fs_info,
> + "duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
The trailing newline is appended by all btrfs_* message helpers, removed
in the commit.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add
2018-11-14 16:05 ` David Sterba
@ 2018-11-15 1:21 ` Lu Fengqi
0 siblings, 0 replies; 5+ messages in thread
From: Lu Fengqi @ 2018-11-15 1:21 UTC (permalink / raw)
To: dsterba, linux-btrfs
On Wed, Nov 14, 2018 at 05:05:48PM +0100, David Sterba wrote:
>On Wed, Nov 14, 2018 at 03:24:56PM +0800, Lu Fengqi wrote:
>> =============================
>> WARNING: suspicious RCU usage
>> 4.20.0-rc2+ #23 Tainted: G O
>> -----------------------------
>> fs/btrfs/volumes.c:886 suspicious rcu_dereference_check() usage!
>>
>> Use btrfs_info_in_rcu instead of pr_info for the required lock/unlock of
>> RCU string.
>>
>> Fixes: 1f265fc6f58b ("btrfs: harden agaist duplicate fsid on scanned devices")
>
>Thanks for the fix.
>
>Please note that the patch is still in the devel queue (misc-next) so
>the commit id is unstable, and such fixups get folded to the patch.
>
>You may also reply to the original mail with patch, but sending a bare
>code change without a full changelog is also fine if the original patch
>was sent long time ago and the fixup could get lost.
Got it.
--
Thanks,
Lu
>
>> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
>> ---
>> fs/btrfs/volumes.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index 2186300bab91..6039ae5c549e 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -873,15 +873,15 @@ static noinline struct btrfs_device *device_list_add(const char *path,
>> if (device->bdev != path_bdev) {
>> bdput(path_bdev);
>> mutex_unlock(&fs_devices->device_list_mutex);
>> - pr_warn(
>> - "BTRFS: duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
>> + btrfs_warn_in_rcu(device->fs_info,
>> + "duplicate device fsid:devid for %pU:%llu old:%s new:%s\n",
>
>The trailing newline is appended by all btrfs_* message helpers, removed
>in the commit.
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-15 1:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 7:24 [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add Lu Fengqi
2018-11-14 7:30 ` Nikolay Borisov
2018-11-14 13:19 ` Anand Jain
2018-11-14 16:05 ` David Sterba
2018-11-15 1:21 ` Lu Fengqi
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).