]> git.baikalelectronics.ru Git - kernel.git/commit
lightnvm: invalid offset calculation for lba_shift
authorMatias Bjørling <m@bjorling.me>
Thu, 10 Nov 2016 11:26:57 +0000 (12:26 +0100)
committerJens Axboe <axboe@fb.com>
Sat, 12 Nov 2016 01:27:32 +0000 (18:27 -0700)
commit355c1f89304e78399c1694a5242fc7277de63a41
tree48c5e6f4ce025fad785016a2087c0f671d61003b
parent693c0bc4f74bf351c20eb9d4d1d7df889c0bdd81
lightnvm: invalid offset calculation for lba_shift

The ns->lba_shift assumes its value to be the logarithmic of the
LA size. A previous patch duplicated the lba_shift calculation into
lightnvm. It prematurely also subtracted a 512byte shift, which commonly
is applied per-command. The 512byte shift being subtracted twice led to
data loss when restoring the logical to physical mapping table from
device and when issuing I/O commands using rrpc.

Fix offset by removing the 512byte shift subtraction when calculating
lba_shift.

Fixes: 37db0578254e "lightnvm: control life of nvm_dev in driver"
Reported-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/host/lightnvm.c