Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit a63850d

Browse files
fdmananagregkh
authored andcommitted
btrfs: zoned: fix missing RCU locking in error message when loading zone info
[ Upstream commit fe4cd7e ] At btrfs_load_zone_info() we have an error path that is dereferencing the name of a device which is a RCU string but we are not holding a RCU read lock, which is incorrect. Fix this by using btrfs_err_in_rcu() instead of btrfs_err(). The problem is there since commit 08e11a3 ("btrfs: zoned: load zone's allocation offset"), back then at btrfs_load_block_group_zone_info() but then later on that code was factored out into the helper btrfs_load_zone_info() by commit 09a4672 ("btrfs: zoned: factor out per-zone logic from btrfs_load_block_group_zone_info"). Fixes: 08e11a3 ("btrfs: zoned: load zone's allocation offset") Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Reviewed-by: Naohiro Aota <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 25c5ef2 commit a63850d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/zoned.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx,
13571357
switch (zone.cond) {
13581358
case BLK_ZONE_COND_OFFLINE:
13591359
case BLK_ZONE_COND_READONLY:
1360-
btrfs_err(fs_info,
1360+
btrfs_err_in_rcu(fs_info,
13611361
"zoned: offline/readonly zone %llu on device %s (devid %llu)",
13621362
(info->physical >> device->zone_info->zone_size_shift),
13631363
rcu_str_deref(device->name), device->devid);

0 commit comments

Comments
 (0)