Change map_io success return code from 0 to 1 [=> bio successfully remapped] --- diff/drivers/md/dm-mpath.c 2004-10-29 15:38:10.000000000 +0100 +++ source/drivers/md/dm-mpath.c 2004-10-29 15:38:17.000000000 +0100 @@ -208,12 +208,9 @@ return 0; } -static struct path *get_current_path(struct multipath *m) +static struct path *__get_current_path(struct multipath *m) { struct path *path; - unsigned long flags; - - spin_lock_irqsave(&m->lock, flags); /* Do we need to select a new path? */ if (!m->current_path || (m->current_count && --m->current_count == 0)) @@ -221,19 +218,22 @@ path = m->current_path; - spin_unlock_irqrestore(&m->lock, flags); - return path; } static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio) { - mpio->path = get_current_path(m); + unsigned long flags; + + spin_lock_irqsave(&m->lock, flags); + mpio->path = __get_current_path(m); + spin_unlock_irqrestore(&m->lock, flags); + if (!mpio->path) return -EIO; bio->bi_bdev = mpio->path->dev->bdev; - return 0; + return 1; } static void dispatch_failed_ios(void *data) @@ -538,13 +538,12 @@ bio->bi_rw |= (1 << BIO_RW_FAILFAST); r = map_io(m, bio, mpio); - if (r) { + if (r < 0) mempool_free(mpio, m->mpio_pool); - return r; - } + else + map_context->ptr = mpio; - map_context->ptr = mpio; - return 1; + return r; } static int fail_path(struct path *path) @@ -701,9 +700,9 @@ /* remap */ dm_bio_restore(&mpio->details, bio); r = map_io(m, bio, mpio); - if (r) + if (r < 0) /* no paths left */ - return -EIO; + return r; /* queue for the daemon to resubmit */ spin_lock(&m->lock);