diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-04-26 14:11:45 +0200 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-05-18 01:19:51 +0200 |
commit | 6b4388ac1f282515db3a651707238cad00b50e80 (patch) | |
tree | 9288c637bdc8b171dbbe13aeedac7179fc9b4fcf /drivers/block/drbd/drbd_receiver.c | |
parent | 087c24925cf4209be1a91f8ede9241e17e9734c7 (diff) | |
download | op-kernel-dev-6b4388ac1f282515db3a651707238cad00b50e80.zip op-kernel-dev-6b4388ac1f282515db3a651707238cad00b50e80.tar.gz |
drbd: Added transmission faults to the fault injection code
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 11b1baf..b27f4dd 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) __ int dgs, ds, i, rr; void *dig_in = mdev->int_dig_in; void *dig_vv = mdev->int_dig_vv; + unsigned long *data; dgs = (mdev->agreed_pro_version >= 87 && mdev->integrity_r_tfm) ? 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) __ ds = data_size; bio_for_each_segment(bvec, bio, i) { page = bvec->bv_page; - rr = drbd_recv(mdev, kmap(page), min_t(int, ds, PAGE_SIZE)); + data = kmap(page); + rr = drbd_recv(mdev, data, min_t(int, ds, PAGE_SIZE)); + if (FAULT_ACTIVE(mdev, DRBD_FAULT_RECEIVE)) { + dev_err(DEV, "Fault injection: Corrupting data on receive\n"); + data[0] = data[0] ^ (unsigned long)-1; + } kunmap(page); if (rr != min_t(int, ds, PAGE_SIZE)) { drbd_free_ee(mdev, e); |