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

[dm-devel] [PATCH] 9/9: Reactivate paths that have come back to life.



If a test bio completes successfully and the path is currently invalid,
reactivate the path.
--- diff/drivers/md/dm-mpath.c	2004-01-13 15:21:51.000000000 -0600
+++ source/drivers/md/dm-mpath.c	2004-01-13 15:44:45.000000000 -0600
@@ -199,15 +199,32 @@
 	path->pg->ps->type->set_path_state(path->pg->ps, path, 0);
 }
 
+static void __recover_path(struct path *path)
+{
+	if (!path->has_failed)
+		return;
+
+	atomic_set(&path->fail_count, MPATH_FAIL_COUNT);
+	list_move(&path->list, &path->pg->valid_paths);
+	path->pg->ps->type->set_path_state(path->pg->ps, path, 1);
+	path->has_failed = 0;
+}
+
 static int test_endio(struct bio *bio, unsigned int done, int error)
 {
 	struct path *path = (struct path *) bio->bi_private;
+	struct multipath *m = path->pg->m;
+	unsigned long flags;
 
 	if (bio->bi_size)
 		return 1;
 
+	spin_lock_irqsave(&m->path_lock, flags);
 	if (error)
 		__fail_path(path);
+	else
+		__recover_path(path);
+	spin_unlock_irqrestore(&m->path_lock, flags);
 
 	up(&path->test_lock);
 	return 0;




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