These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / md / multipath.c
index ac3ede2..0a72ab6 100644 (file)
@@ -77,18 +77,18 @@ static void multipath_end_bh_io (struct multipath_bh *mp_bh, int err)
        struct bio *bio = mp_bh->master_bio;
        struct mpconf *conf = mp_bh->mddev->private;
 
-       bio_endio(bio, err);
+       bio->bi_error = err;
+       bio_endio(bio);
        mempool_free(mp_bh, conf->pool);
 }
 
-static void multipath_end_request(struct bio *bio, int error)
+static void multipath_end_request(struct bio *bio)
 {
-       int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
        struct multipath_bh *mp_bh = bio->bi_private;
        struct mpconf *conf = mp_bh->mddev->private;
        struct md_rdev *rdev = conf->multipaths[mp_bh->path].rdev;
 
-       if (uptodate)
+       if (!bio->bi_error)
                multipath_end_bh_io(mp_bh, 0);
        else if (!(bio->bi_rw & REQ_RAHEAD)) {
                /*
@@ -101,7 +101,7 @@ static void multipath_end_request(struct bio *bio, int error)
                       (unsigned long long)bio->bi_iter.bi_sector);
                multipath_reschedule_retry(mp_bh);
        } else
-               multipath_end_bh_io(mp_bh, error);
+               multipath_end_bh_io(mp_bh, bio->bi_error);
        rdev_dec_pending(rdev, conf->mddev);
 }
 
@@ -123,7 +123,7 @@ static void multipath_make_request(struct mddev *mddev, struct bio * bio)
 
        mp_bh->path = multipath_map(conf);
        if (mp_bh->path < 0) {
-               bio_endio(bio, -EIO);
+               bio_io_error(bio);
                mempool_free(mp_bh, conf->pool);
                return;
        }
@@ -257,18 +257,9 @@ static int multipath_add_disk(struct mddev *mddev, struct md_rdev *rdev)
                        disk_stack_limits(mddev->gendisk, rdev->bdev,
                                          rdev->data_offset << 9);
 
-               /* as we don't honour merge_bvec_fn, we must never risk
-                * violating it, so limit ->max_segments to one, lying
-                * within a single page.
-                * (Note: it is very unlikely that a device with
-                * merge_bvec_fn will be involved in multipath.)
-                */
-                       if (q->merge_bvec_fn) {
-                               blk_queue_max_segments(mddev->queue, 1);
-                               blk_queue_segment_boundary(mddev->queue,
-                                                          PAGE_CACHE_SIZE - 1);
-                       }
-
+                       err = md_integrity_add_rdev(rdev, mddev);
+                       if (err)
+                               break;
                        spin_lock_irq(&conf->device_lock);
                        mddev->degraded--;
                        rdev->raid_disk = path;
@@ -276,7 +267,6 @@ static int multipath_add_disk(struct mddev *mddev, struct md_rdev *rdev)
                        spin_unlock_irq(&conf->device_lock);
                        rcu_assign_pointer(p->rdev, rdev);
                        err = 0;
-                       md_integrity_add_rdev(rdev, mddev);
                        break;
                }
 
@@ -432,15 +422,6 @@ static int multipath_run (struct mddev *mddev)
                disk_stack_limits(mddev->gendisk, rdev->bdev,
                                  rdev->data_offset << 9);
 
-               /* as we don't honour merge_bvec_fn, we must never risk
-                * violating it, not that we ever expect a device with
-                * a merge_bvec_fn to be involved in multipath */
-               if (rdev->bdev->bd_disk->queue->merge_bvec_fn) {
-                       blk_queue_max_segments(mddev->queue, 1);
-                       blk_queue_segment_boundary(mddev->queue,
-                                                  PAGE_CACHE_SIZE - 1);
-               }
-
                if (!test_bit(Faulty, &rdev->flags))
                        working_disks++;
        }
@@ -491,8 +472,7 @@ static int multipath_run (struct mddev *mddev)
        return 0;
 
 out_free_conf:
-       if (conf->pool)
-               mempool_destroy(conf->pool);
+       mempool_destroy(conf->pool);
        kfree(conf->multipaths);
        kfree(conf);
        mddev->private = NULL;