Patch "md/raid10: use dereference_rdev_and_rrdev() to get devices" has been added to the 5.15-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

    md/raid10: use dereference_rdev_and_rrdev() to get devices

to the 5.15-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:
     md-raid10-use-dereference_rdev_and_rrdev-to-get-devi.patch
and it can be found in the queue-5.15 subdirectory.

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



commit e74871d6e028a78b22eeb7983f073f0c5da94f86
Author: Li Nan <linan122@xxxxxxxxxx>
Date:   Sat Jul 1 16:05:29 2023 +0800

    md/raid10: use dereference_rdev_and_rrdev() to get devices
    
    [ Upstream commit 673643490b9a0eb3b25633abe604f62b8f63dba1 ]
    
    Commit 2ae6aaf76912 ("md/raid10: fix io loss while replacement replace
    rdev") reads replacement first to prevent io loss. However, there are same
    issue in wait_blocked_dev() and raid10_handle_discard(), too. Fix it by
    using dereference_rdev_and_rrdev() to get devices.
    
    Fixes: d30588b2731f ("md/raid10: improve raid10 discard request")
    Fixes: f2e7e269a752 ("md/raid10: pull the code that wait for blocked dev into one function")
    Signed-off-by: Li Nan <linan122@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230701080529.2684932-4-linan666@xxxxxxxxxxxxxxx
    Signed-off-by: Song Liu <song@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index ff3c97cde7699..a3a3a02d48b17 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1345,11 +1345,9 @@ static void wait_blocked_dev(struct mddev *mddev, struct r10bio *r10_bio)
 	blocked_rdev = NULL;
 	rcu_read_lock();
 	for (i = 0; i < conf->copies; i++) {
-		struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev);
-		struct md_rdev *rrdev = rcu_dereference(
-			conf->mirrors[i].replacement);
-		if (rdev == rrdev)
-			rrdev = NULL;
+		struct md_rdev *rdev, *rrdev;
+
+		rdev = dereference_rdev_and_rrdev(&conf->mirrors[i], &rrdev);
 		if (rdev && unlikely(test_bit(Blocked, &rdev->flags))) {
 			atomic_inc(&rdev->nr_pending);
 			blocked_rdev = rdev;
@@ -1785,10 +1783,9 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio)
 	 */
 	rcu_read_lock();
 	for (disk = 0; disk < geo->raid_disks; disk++) {
-		struct md_rdev *rdev = rcu_dereference(conf->mirrors[disk].rdev);
-		struct md_rdev *rrdev = rcu_dereference(
-			conf->mirrors[disk].replacement);
+		struct md_rdev *rdev, *rrdev;
 
+		rdev = dereference_rdev_and_rrdev(&conf->mirrors[disk], &rrdev);
 		r10_bio->devs[disk].bio = NULL;
 		r10_bio->devs[disk].repl_bio = NULL;
 



[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