aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-raid1.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-raid1.c')
-rw-r--r--drivers/md/dm-raid1.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index bdf1606f67bc..9a8b71067c6e 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -145,7 +145,6 @@ static void dispatch_bios(void *context, struct bio_list *bio_list)
145 145
146struct dm_raid1_bio_record { 146struct dm_raid1_bio_record {
147 struct mirror *m; 147 struct mirror *m;
148 /* if details->bi_bdev == NULL, details were not saved */
149 struct dm_bio_details details; 148 struct dm_bio_details details;
150 region_t write_region; 149 region_t write_region;
151}; 150};
@@ -1200,8 +1199,6 @@ static int mirror_map(struct dm_target *ti, struct bio *bio)
1200 struct dm_raid1_bio_record *bio_record = 1199 struct dm_raid1_bio_record *bio_record =
1201 dm_per_bio_data(bio, sizeof(struct dm_raid1_bio_record)); 1200 dm_per_bio_data(bio, sizeof(struct dm_raid1_bio_record));
1202 1201
1203 bio_record->details.bi_bdev = NULL;
1204
1205 if (rw == WRITE) { 1202 if (rw == WRITE) {
1206 /* Save region for mirror_end_io() handler */ 1203 /* Save region for mirror_end_io() handler */
1207 bio_record->write_region = dm_rh_bio_to_region(ms->rh, bio); 1204 bio_record->write_region = dm_rh_bio_to_region(ms->rh, bio);
@@ -1260,22 +1257,12 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error)
1260 } 1257 }
1261 1258
1262 if (error == -EOPNOTSUPP) 1259 if (error == -EOPNOTSUPP)
1263 goto out; 1260 return error;
1264 1261
1265 if ((error == -EWOULDBLOCK) && (bio->bi_opf & REQ_RAHEAD)) 1262 if ((error == -EWOULDBLOCK) && (bio->bi_opf & REQ_RAHEAD))
1266 goto out; 1263 return error;
1267 1264
1268 if (unlikely(error)) { 1265 if (unlikely(error)) {
1269 if (!bio_record->details.bi_bdev) {
1270 /*
1271 * There wasn't enough memory to record necessary
1272 * information for a retry or there was no other
1273 * mirror in-sync.
1274 */
1275 DMERR_LIMIT("Mirror read failed.");
1276 return -EIO;
1277 }
1278
1279 m = bio_record->m; 1266 m = bio_record->m;
1280 1267
1281 DMERR("Mirror read failed from %s. Trying alternative device.", 1268 DMERR("Mirror read failed from %s. Trying alternative device.",
@@ -1291,7 +1278,7 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error)
1291 bd = &bio_record->details; 1278 bd = &bio_record->details;
1292 1279
1293 dm_bio_restore(bd, bio); 1280 dm_bio_restore(bd, bio);
1294 bio_record->details.bi_bdev = NULL; 1281 bio->bi_error = 0;
1295 1282
1296 queue_bio(ms, bio, rw); 1283 queue_bio(ms, bio, rw);
1297 return DM_ENDIO_INCOMPLETE; 1284 return DM_ENDIO_INCOMPLETE;
@@ -1299,9 +1286,6 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error)
1299 DMERR("All replicated volumes dead, failing I/O"); 1286 DMERR("All replicated volumes dead, failing I/O");
1300 } 1287 }
1301 1288
1302out:
1303 bio_record->details.bi_bdev = NULL;
1304
1305 return error; 1289 return error;
1306} 1290}
1307 1291