If a test bio completes successfully and the path is currently invalid, reactivate the path. [Kevin Corry] --- diff/drivers/md/dm-mpath.c 2004-01-16 14:40:56.000000000 +0000 +++ source/drivers/md/dm-mpath.c 2004-01-16 14:41:56.000000000 +0000 @@ -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;