ore: Fix wrong math in allocation of per device BIO
authorBoaz Harrosh <bharrosh@panasas.com>
Thu, 21 Nov 2013 15:58:08 +0000 (17:58 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 1 Apr 2014 23:58:45 +0000 (00:58 +0100)
commitc99cf525de222205729192b47e2b859096abe03a
treeee8fdfaa8aacc4af2345e5366016d8dcbd1b730e
parent17c9dc712c75ac71d18a222d3d5b2f9dad5867b4
ore: Fix wrong math in allocation of per device BIO

commit aad560b7f63b495f48a7232fd086c5913a676e6f upstream.

At IO preparation we calculate the max pages at each device and
allocate a BIO per device of that size. The calculation was wrong
on some unaligned corner cases offset/length combination and would
make prepare return with -ENOMEM. This would be bad for pnfs-objects
that would in that case IO through MDS. And fatal for exofs were it
would fail writes with EIO.

Fix it by doing the proper math, that will work in all cases. (I
ran a test with all possible offset/length combinations this time
round).

Also when reading we do not need to allocate for the parity units
since we jump over them.

Also lower the max_io_length to take into account the parity pages
so not to allocate BIOs bigger than PAGE_SIZE

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/exofs/ore.c
include/scsi/osd_ore.h