Skip to content

Commit fe4cd7e

Browse files
fdmananakdave
authored andcommitted
btrfs: zoned: fix missing RCU locking in error message when loading zone info
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]>
1 parent 6ef8fbc commit fe4cd7e

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
@@ -1340,7 +1340,7 @@ static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx,
13401340
switch (zone.cond) {
13411341
case BLK_ZONE_COND_OFFLINE:
13421342
case BLK_ZONE_COND_READONLY:
1343-
btrfs_err(fs_info,
1343+
btrfs_err_in_rcu(fs_info,
13441344
"zoned: offline/readonly zone %llu on device %s (devid %llu)",
13451345
(info->physical >> device->zone_info->zone_size_shift),
13461346
rcu_str_deref(device->name), device->devid);

0 commit comments

Comments
 (0)