[PATCH] md: fail IO request to md that require a barrier.
authorNeilBrown <neilb@cse.unsw.edu.au>
Fri, 9 Sep 2005 23:23:41 +0000 (16:23 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 9 Sep 2005 23:39:09 +0000 (16:39 -0700)
md does not yet support BIO_RW_BARRIER, so be honest about it and fail
(-EOPNOTSUPP) any such requests.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/linear.c
drivers/md/multipath.c
drivers/md/raid0.c
drivers/md/raid1.c
drivers/md/raid10.c
drivers/md/raid5.c
drivers/md/raid6main.c

index 8d740013d74d5eff047d99f02d1f93d7b65218bd..4991ba543368a795c53325caf169d853e6422436 100644 (file)
@@ -238,6 +238,11 @@ static int linear_make_request (request_queue_t *q, struct bio *bio)
        dev_info_t *tmp_dev;
        sector_t block;
 
+       if (unlikely(bio_barrier(bio))) {
+               bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
+               return 0;
+       }
+
        if (bio_data_dir(bio)==WRITE) {
                disk_stat_inc(mddev->gendisk, writes);
                disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio));
index 2d2ca7fa0265261a71e2493e88b68403cc902c57..286342375fb7f84d5d400e28755e4347f7e99035 100644 (file)
@@ -169,6 +169,11 @@ static int multipath_make_request (request_queue_t *q, struct bio * bio)
        struct multipath_bh * mp_bh;
        struct multipath_info *multipath;
 
+       if (unlikely(bio_barrier(bio))) {
+               bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
+               return 0;
+       }
+
        mp_bh = mempool_alloc(conf->pool, GFP_NOIO);
 
        mp_bh->master_bio = bio;
index 2120710172c5411a4743686762878a76e8aa7695..f6757259ce7fe3f8ced8b05553f2cf52c25e6dbb 100644 (file)
@@ -404,6 +404,11 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
        unsigned long chunk;
        sector_t block, rsect;
 
+       if (unlikely(bio_barrier(bio))) {
+               bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
+               return 0;
+       }
+
        if (bio_data_dir(bio)==WRITE) {
                disk_stat_inc(mddev->gendisk, writes);
                disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio));
index 51d9645ed09c5e8ff79aa9e7a6604e94dc274a54..ace41c571aeb3f2e842d65fc2fa9959240bf4054 100644 (file)
@@ -555,6 +555,10 @@ static int make_request(request_queue_t *q, struct bio * bio)
        unsigned long flags;
        struct bio_list bl;
 
+       if (unlikely(bio_barrier(bio))) {
+               bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
+               return 0;
+       }
 
        /*
         * Register the new request and wait if the reconstruction
index 7239079203ec1aa6652ddda6b990b4adf5cf0064..5e0b333793d5bbe705f34671b167b064b88cdfd1 100644 (file)
@@ -669,6 +669,11 @@ static int make_request(request_queue_t *q, struct bio * bio)
        int i;
        int chunk_sects = conf->chunk_mask + 1;
 
+       if (unlikely(bio_barrier(bio))) {
+               bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
+               return 0;
+       }
+
        /* If this request crosses a chunk boundary, we need to
         * split it.  This will only happen for 1 PAGE (or less) requests.
         */
index 43f231a467d5cb0137f15bd5568de80993a0bb08..ed859e08d600fbbc31ba8877fe440fd6167201cd 100644 (file)
@@ -1411,6 +1411,11 @@ static int make_request (request_queue_t *q, struct bio * bi)
        sector_t logical_sector, last_sector;
        struct stripe_head *sh;
 
+       if (unlikely(bio_barrier(bi))) {
+               bio_endio(bi, bi->bi_size, -EOPNOTSUPP);
+               return 0;
+       }
+
        md_write_start(mddev, bi);
 
        if (bio_data_dir(bi)==WRITE) {
index 495dee1d1e8335bcef634be427e0132bb596413e..09cb7272c09f9d7e9f9596453d8ab406678fcc1e 100644 (file)
@@ -1570,6 +1570,11 @@ static int make_request (request_queue_t *q, struct bio * bi)
        sector_t logical_sector, last_sector;
        struct stripe_head *sh;
 
+       if (unlikely(bio_barrier(bi))) {
+               bio_endio(bi, bi->bi_size, -EOPNOTSUPP);
+               return 0;
+       }
+
        md_write_start(mddev, bi);
 
        if (bio_data_dir(bi)==WRITE) {