Re: [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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@xxxxxxxxxxxxxx>

 Thanks Lu. I missed it.
 Reviewed-by: Anand Jain <anand.jain@xxxxxxxxxx>


---
  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);
  		}




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux