mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miroslav Cimerman <mc@raidlab.org>
To: Song Liu <song@kernel.org>, Yu Kuai <yukuai@fygo.io>
Cc: Li Nan <magiclinan@didiglobal.com>, Xiao Ni <xiao@kernel.org>,
	NeilBrown <neil@brown.name>,
	Mariusz Tkaczyk <mtkaczyk@kernel.org>, Kenta Akagi <k@mgml.me>,
	linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 6/8] md/raid1: set MD_SB_CHANGE_PENDING under device_lock in raid1_error()
Date: Fri, 27 Nov 2026 00:32:29 +0000	[thread overview]
Message-ID: <20261127003231.1180197-7-mc@raidlab.org> (raw)
In-Reply-To: <20261127003231.1180197-1-mc@raidlab.org>

raid1_error() drops device_lock after it sets Faulty and before it sets
MD_SB_CHANGE_PENDING. raid1d can release a held write in between,
before the superblock records the failure.

Set MD_SB_CHANGE_PENDING under the lock, as raid10_error() does.

Fixes: 55ce74d4bfe1 ("md/raid1: ensure device failure recorded before write request returns.")
Cc: stable@vger.kernel.org
Signed-off-by: Miroslav Cimerman <mc@raidlab.org>
---
 drivers/md/raid1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 54ba3013150e..f596b36ec6e1 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1741,13 +1741,13 @@ static void raid1_error(struct mddev *mddev, struct md_rdev *rdev)
 	if (test_and_clear_bit(In_sync, &rdev->flags))
 		mddev->degraded++;
 	set_bit(Faulty, &rdev->flags);
+	set_mask_bits(&mddev->sb_flags, 0,
+		      BIT(MD_SB_CHANGE_DEVS) | BIT(MD_SB_CHANGE_PENDING));
 	spin_unlock_irqrestore(&conf->device_lock, flags);
 	/*
 	 * if recovery is running, make sure it aborts.
 	 */
 	set_bit(MD_RECOVERY_INTR, &mddev->recovery);
-	set_mask_bits(&mddev->sb_flags, 0,
-		      BIT(MD_SB_CHANGE_DEVS) | BIT(MD_SB_CHANGE_PENDING));
 	pr_crit("md/raid1:%s: Disk failure on %pg, disabling device.\n"
 		"md/raid1:%s: Operation continuing on %d devices.\n",
 		mdname(mddev), rdev->bdev,
-- 
2.53.0


  parent reply	other threads:[~2026-11-27  0:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  0:32 [PATCH 0/8] md/raid1,raid10: fix writes acknowledged before a failure is recorded Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 1/8] md/raid1,raid10: fail held writes when the array fails Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 2/8] md/raid10: wait for the devices of the write in wait_blocked_dev() Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 3/8] md/raid1,raid10: fail writes that waited while the array failed Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 4/8] md/raid1,raid10: fail held writes that no working device has Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 5/8] md/raid1,raid10: hold writes that fail on a faulty device Miroslav Cimerman
2026-11-27  0:32 ` Miroslav Cimerman [this message]
2026-11-27  0:32 ` [PATCH 7/8] md/raid1,raid10: hold writes that skip a newly failed device Miroslav Cimerman
2026-11-27  0:32 ` [PATCH 8/8] md/raid1: hold write-behind writes that failed on a device Miroslav Cimerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127003231.1180197-7-mc@raidlab.org \
    --to=mc@raidlab.org \
    --cc=k@mgml.me \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=magiclinan@didiglobal.com \
    --cc=mtkaczyk@kernel.org \
    --cc=neil@brown.name \
    --cc=song@kernel.org \
    --cc=xiao@kernel.org \
    --cc=yukuai@fygo.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®