Patch "btrfs: be a bit more careful when setting mirror_num_ret in btrfs_map_block" has been added to the 6.1-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    btrfs: be a bit more careful when setting mirror_num_ret in btrfs_map_block

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     btrfs-be-a-bit-more-careful-when-setting-mirror_num_.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 34038040cc781e64ecfa341e776b1d3ca1839d8a
Author: Christoph Hellwig <hch@xxxxxx>
Date:   Tue Jun 27 08:13:23 2023 +0200

    btrfs: be a bit more careful when setting mirror_num_ret in btrfs_map_block
    
    [ Upstream commit 4e7de35eb7d1a1d4f2dda15f39fbedd4798a0b8d ]
    
    The mirror_num_ret is allowed to be NULL, although it has to be set when
    smap is set.  Unfortunately that is not a well enough specifiable
    invariant for static type checkers, so add a NULL check to make sure they
    are fine.
    
    Fixes: 03793cbbc80f ("btrfs: add fast path for single device io in __btrfs_map_block")
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Reviewed-by: David Sterba <dsterba@xxxxxxxx>
    Signed-off-by: David Sterba <dsterba@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 7433ae929fdcb..2e0832d70406c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6595,11 +6595,13 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
 		if (patch_the_first_stripe_for_dev_replace) {
 			smap->dev = dev_replace->tgtdev;
 			smap->physical = physical_to_patch_in_first_stripe;
-			*mirror_num_ret = map->num_stripes + 1;
+			if (mirror_num_ret)
+				*mirror_num_ret = map->num_stripes + 1;
 		} else {
 			set_io_stripe(smap, map, stripe_index, stripe_offset,
 				      stripe_nr);
-			*mirror_num_ret = mirror_num;
+			if (mirror_num_ret)
+				*mirror_num_ret = mirror_num;
 		}
 		*bioc_ret = NULL;
 		ret = 0;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux