Below two comments are fixed in the misc-next.
Reviewed-by: Anand Jain <anand.jain@xxxxxxxxxx>
Thanks.
On 18/11/20 7:17 pm, Anand Jain wrote:
Also, %device->fs_info is not protected. It is better to avoid using
fs_info when we are still at open_fs_devices(). Yeah, the unknown part
can be better. We need to fix it as a whole. For now, you can use
something like...
-------------------------
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 1223d5b0e411..e857bb304d28 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -130,19 +130,11 @@ int btrfs_get_dev_zone_info(struct btrfs_device
*device)
* (device <unknown>) ..."
*/
- rcu_read_lock();
- if (device->fs_info)
- btrfs_info(device->fs_info,
- "host-%s zoned block device %s, %u zones of %llu
bytes",
- bdev_zoned_model(bdev) == BLK_ZONED_HM ?
"managed" : "aware",
- rcu_str_deref(device->name), zone_info->nr_zones,
- zone_info->zone_size);
- else
- pr_info("BTRFS info: host-%s zoned block device %s, %u
zones of %llu bytes",
- bdev_zoned_model(bdev) == BLK_ZONED_HM ?
"managed" : "aware",
- rcu_str_deref(device->name), zone_info->nr_zones,
- zone_info->zone_size);
- rcu_read_unlock();
+ btrfs_info_in_rcu(NULL,
+ "host-%s zoned block device %s, %u zones of %llu bytes",
+ bdev_zoned_model(bdev) == BLK_ZONED_HM ? "managed" :
"aware",
+ rcu_str_deref(device->name), zone_info->nr_zones,
+ zone_info->zone_size);
return 0;
---------------------------
Thanks, Anand
@@ -374,6 +375,7 @@ void btrfs_free_device(struct btrfs_device *device)
rcu_string_free(device->name);
extent_io_tree_release(&device->alloc_state);
bio_put(device->flush_bio);
+ btrfs_destroy_dev_zone_info(device);
Free of btrfs_device::zone_info is already happening in the path..
btrfs_close_one_device()
btrfs_destroy_dev_zone_info()
We don't need this..
btrfs_free_device()
btrfs_destroy_dev_zone_info()
Ah, yes, I once had it only in btrfs_free_device() and noticed that it
does
not free the device zone info on umount. So, I added one in
btrfs_close_one_device() and forgot to remove the other one. I'll drop it
from btrfs_free_device().