Skip to contentSkip to conversation

dm-raid1: add cancel_presuspend function

RFC PATCH In review Takahiro Yasui 1 participant 1 message Jan 19, 2010 Device mapper

lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/3 dm-raid1: add cancel_presuspend function

When suspend is interrupted after presuspend procedure, mirror target needs to reset and release following variables:
- reset ms->suspend flag
- release semaphore (rh->recovery_count)

---
 drivers/md/dm-raid1.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/md/dm-raid1.c +9 -0
Index: linux-2.6.33-rc1-dm/drivers/md/dm-raid1.c
===================================================================
@@ -1311,6 +1311,14 @@ static void mirror_postsuspend(struct dm
 		DMWARN("log postsuspend failed");
 }
 
+static void mirror_cancel_presuspend(struct dm_target *ti)
+{
+	struct mirror_set *ms = ti->private;
+
+	atomic_set(&ms->suspend, 0);
+	dm_rh_start_recovery(ms->rh);
+}
+
 static void mirror_resume(struct dm_target *ti)
 {
 	struct mirror_set *ms = ti->private;
@@ -1412,6 +1420,7 @@ static struct target_type mirror_target 
 	.end_io	 = mirror_end_io,
 	.presuspend = mirror_presuspend,
 	.postsuspend = mirror_postsuspend,
+	.cancel_presuspend = mirror_cancel_presuspend,
 	.resume	 = mirror_resume,
 	.status	 = mirror_status,
 	.iterate_devices = mirror_iterate_devices,
Signature · 2 lines
Takahiro Yasui
Hitachi Computer Products (America), Inc.