[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240201092559.910982-12-yukuai1@huaweicloud.com>
Date: Thu, 1 Feb 2024 17:25:56 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: mpatocka@...hat.com,
heinzm@...hat.com,
xni@...hat.com,
blazej.kucman@...ux.intel.com,
agk@...hat.com,
snitzer@...nel.org,
dm-devel@...ts.linux.dev,
song@...nel.org,
yukuai3@...wei.com,
jbrassow@....redhat.com,
neilb@...e.de,
shli@...com,
akpm@...l.org
Cc: linux-kernel@...r.kernel.org,
linux-raid@...r.kernel.org,
yukuai1@...weicloud.com,
yi.zhang@...wei.com,
yangerkun@...wei.com
Subject: [PATCH v5 11/14] dm-raid: add a new helper prepare_suspend() in md_personality
From: Yu Kuai <yukuai3@...wei.com>
There are no functional changes for now, prepare to fix a deadlock for
dm-raid456.
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
drivers/md/dm-raid.c | 10 +++++++---
drivers/md/md.h | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 6b6c011d9f69..16d3348abfed 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3806,10 +3806,14 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
static void raid_presuspend(struct dm_target *ti)
{
struct raid_set *rs = ti->private;
+ struct mddev *mddev = &rs->md;
- mddev_lock_nointr(&rs->md);
- md_frozen_sync_thread(&rs->md);
- mddev_unlock(&rs->md);
+ mddev_lock_nointr(mddev);
+ md_frozen_sync_thread(mddev);
+ mddev_unlock(mddev);
+
+ if (mddev->pers && mddev->pers->prepare_suspend)
+ mddev->pers->prepare_suspend(mddev);
}
static void raid_presuspend_undo(struct dm_target *ti)
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 684cc866402a..8e81f9e2fb20 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -629,6 +629,7 @@ struct md_personality
int (*start_reshape) (struct mddev *mddev);
void (*finish_reshape) (struct mddev *mddev);
void (*update_reshape_pos) (struct mddev *mddev);
+ void (*prepare_suspend) (struct mddev *mddev);
/* quiesce suspends or resumes internal processing.
* 1 - stop new actions and wait for action io to complete
* 0 - return to normal behaviour
--
2.39.2
Powered by blists - more mailing lists