Re: [Patch 1/6] dm: endio method

Mike Christie
2004-02-21T10:30:10Z

Joe Thornber wrote:

> Add an endio method to targets. This method is allowed to request
> another shot at failed ios (think multipath).

> + if (endio) {
> + /* Restore bio fields. */
> + bio->bi_sector = tio->bi_sector;
> + bio->bi_bdev = tio->bi_bdev;
> + bio->bi_size = tio->bi_size;
> + bio->bi_idx = tio->bi_idx;
> +
> + r = endio(tio->ti, bio, error, &tio->info);

> + r = ti->type->map(ti, clone, &tio->info);
> + if (r > 0) {
> + /* Save the bio info so we can restore it during endio. */
> + tio->bi_sector = clone->bi_sector;
> + tio->bi_bdev = clone->bi_bdev;
> + tio->bi_size = clone->bi_size;
> + tio->bi_idx = clone->bi_idx;

Saving and restoring bi_bdev is going to break multipath. When a bio is
remapped and resent multiple times by the target becuase of multiple
path failures, restoring bi_bdev to the original value will cause only
that path to be marked as failed instead of the paths that the bio was
remapped to.

This is DM's cloned bio. Is there a guarantee that this value should be
safe from lower level drivers overwriting it, or is it similar to b_rdev
for buffer_heads?

Mike Christie