block: fix blk_integrity_register to use template's interval_exp if not 0
authorMike Snitzer <snitzer@redhat.com>
Sat, 22 Apr 2017 21:22:09 +0000 (17:22 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 May 2017 12:30:58 +0000 (14:30 +0200)
commit635aff41e59a42b7a13884ab65de78df32800a9b
treee6dce0331df851445bcf4946bd5f43083c1952fa
parent5c5d86be4f3fdb95cf9356687ca79af6cc325177
block: fix blk_integrity_register to use template's interval_exp if not 0

commit 2859323e35ab5fc42f351fbda23ab544eaa85945 upstream.

When registering an integrity profile: if the template's interval_exp is
not 0 use it, otherwise use the ilog2() of logical block size of the
provided gendisk.

This fixes a long-standing DM linear target bug where it cannot pass
integrity data to the underlying device if its logical block size
conflicts with the underlying device's logical block size.

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-integrity.c