diff options
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 1 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 3 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 8 |
3 files changed, 10 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index e09132483980..2409de12f013 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -132,6 +132,7 @@ enum { | |||
132 | DRBD_FAULT_DT_RA = 6, /* data read ahead */ | 132 | DRBD_FAULT_DT_RA = 6, /* data read ahead */ |
133 | DRBD_FAULT_BM_ALLOC = 7, /* bitmap allocation */ | 133 | DRBD_FAULT_BM_ALLOC = 7, /* bitmap allocation */ |
134 | DRBD_FAULT_AL_EE = 8, /* alloc ee */ | 134 | DRBD_FAULT_AL_EE = 8, /* alloc ee */ |
135 | DRBD_FAULT_RECEIVE = 9, /* Changes some bytes upon receiving a [rs]data block */ | ||
135 | 136 | ||
136 | DRBD_FAULT_MAX, | 137 | DRBD_FAULT_MAX, |
137 | }; | 138 | }; |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index a478dad82dae..7468d2ce7347 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -3668,7 +3668,8 @@ _drbd_fault_str(unsigned int type) { | |||
3668 | [DRBD_FAULT_DT_RD] = "Data read", | 3668 | [DRBD_FAULT_DT_RD] = "Data read", |
3669 | [DRBD_FAULT_DT_RA] = "Data read ahead", | 3669 | [DRBD_FAULT_DT_RA] = "Data read ahead", |
3670 | [DRBD_FAULT_BM_ALLOC] = "BM allocation", | 3670 | [DRBD_FAULT_BM_ALLOC] = "BM allocation", |
3671 | [DRBD_FAULT_AL_EE] = "EE allocation" | 3671 | [DRBD_FAULT_AL_EE] = "EE allocation", |
3672 | [DRBD_FAULT_RECEIVE] = "receive data corruption", | ||
3672 | }; | 3673 | }; |
3673 | 3674 | ||
3674 | return (type < DRBD_FAULT_MAX) ? _faults[type] : "**Unknown**"; | 3675 | return (type < DRBD_FAULT_MAX) ? _faults[type] : "**Unknown**"; |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 11b1bafde28b..b27f4dd36f89 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -1270,6 +1270,7 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector, int data_size) __ | |||
1270 | int dgs, ds, i, rr; | 1270 | int dgs, ds, i, rr; |
1271 | void *dig_in = mdev->int_dig_in; | 1271 | void *dig_in = mdev->int_dig_in; |
1272 | void *dig_vv = mdev->int_dig_vv; | 1272 | void *dig_vv = mdev->int_dig_vv; |
1273 | unsigned long *data; | ||
1273 | 1274 | ||
1274 | dgs = (mdev->agreed_pro_version >= 87 && mdev->integrity_r_tfm) ? | 1275 | dgs = (mdev->agreed_pro_version >= 87 && mdev->integrity_r_tfm) ? |
1275 | crypto_hash_digestsize(mdev->integrity_r_tfm) : 0; | 1276 | crypto_hash_digestsize(mdev->integrity_r_tfm) : 0; |
@@ -1307,7 +1308,12 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector, int data_size) __ | |||
1307 | ds = data_size; | 1308 | ds = data_size; |
1308 | bio_for_each_segment(bvec, bio, i) { | 1309 | bio_for_each_segment(bvec, bio, i) { |
1309 | page = bvec->bv_page; | 1310 | page = bvec->bv_page; |
1310 | rr = drbd_recv(mdev, kmap(page), min_t(int, ds, PAGE_SIZE)); | 1311 | data = kmap(page); |
1312 | rr = drbd_recv(mdev, data, min_t(int, ds, PAGE_SIZE)); | ||
1313 | if (FAULT_ACTIVE(mdev, DRBD_FAULT_RECEIVE)) { | ||
1314 | dev_err(DEV, "Fault injection: Corrupting data on receive\n"); | ||
1315 | data[0] = data[0] ^ (unsigned long)-1; | ||
1316 | } | ||
1311 | kunmap(page); | 1317 | kunmap(page); |
1312 | if (rr != min_t(int, ds, PAGE_SIZE)) { | 1318 | if (rr != min_t(int, ds, PAGE_SIZE)) { |
1313 | drbd_free_ee(mdev, e); | 1319 | drbd_free_ee(mdev, e); |