linux/drivers/lightnvm
Javier González 75cb8e939c lightnvm: pblk: advance bio according to lba index
When a lba either hits the cache or corresponds to an empty entry in the
L2P table, we need to advance the bio according to the position in which
the lba is located. Otherwise, we will copy data in the wrong page, thus
causing data corruption for the application.

In case of a cache hit, we assumed that bio->bi_iter.bi_idx would
contain the correct index, but this is no necessarily true. Instead, use
the local bio advance counter and iterator. This guarantees that lbas
hitting the cache are copied into the right bv_page.

In case of an empty L2P entry, we omitted to advance the bio. In the
cases when the same I/O also contains a cache hit, data corresponding
to this lba will be copied to the wrong bv_page. Fix this by advancing
the bio as we do in the case of a cache hit.

Fixes: a4bd217b43 lightnvm: physical block device (pblk) target

Signed-off-by: Javier González <javier@javigon.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2017-07-28 08:06:00 -06:00
..
core.c lightnvm: if LUNs are already allocated fix return 2017-06-27 08:22:09 -06:00
Kconfig lightnvm: physical block device (pblk) target 2017-04-16 10:06:33 -06:00
Makefile lightnvm: physical block device (pblk) target 2017-04-16 10:06:33 -06:00
pblk-cache.c lightnvm: pblk: fail gracefully on irrec. error 2017-06-26 16:27:39 -06:00
pblk-core.c lightnvm: pblk: control I/O flow also on tear down 2017-07-07 13:17:34 -06:00
pblk-gc.c lightnvm: pblk: use vmalloc for GC data buffer 2017-06-30 11:08:18 -06:00
pblk-init.c lightnvm: pblk: add initialization check 2017-06-30 11:08:18 -06:00
pblk-map.c lightnvm: pblk: fix bad le64 assignations 2017-06-30 11:08:18 -06:00
pblk-rb.c lightnvm: pblk: advance bio according to lba index 2017-07-28 08:06:00 -06:00
pblk-read.c lightnvm: pblk: advance bio according to lba index 2017-07-28 08:06:00 -06:00
pblk-recovery.c lightnvm: pblk: control I/O flow also on tear down 2017-07-07 13:17:34 -06:00
pblk-rl.c lightnvm: pblk: fail gracefully on irrec. error 2017-06-26 16:27:39 -06:00
pblk-sysfs.c lightnvm: pblk: remove unused return variable 2017-06-30 11:08:18 -06:00
pblk-write.c lightnvm: pblk: remove unnecessary checks 2017-07-07 13:17:36 -06:00
pblk.h lightnvm: pblk: advance bio according to lba index 2017-07-28 08:06:00 -06:00
rrpc.c blk: remove bio_set arg from blk_queue_split() 2017-06-18 12:40:59 -06:00
rrpc.h