]> www.infradead.org Git - users/jedix/linux-maple.git/commit
block: eliminate potential for infinite loop in blkdev_issue_discard
authorMike Snitzer <snitzer@redhat.com>
Wed, 6 Jul 2011 19:30:50 +0000 (21:30 +0200)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 14 Mar 2012 16:16:52 +0000 (12:16 -0400)
commitb2274c1baa3d723e8a43c4cd486c5497d7957af0
tree7109fcbd44087dcdd53ac27bbb4af6de4f140d23
parentc21ff47489b44121e1684274cab9d890c963a561
block: eliminate potential for infinite loop in blkdev_issue_discard

Due to the recently identified overflow in read_capacity_16() it was
possible for max_discard_sectors to be zero but still have discards
enabled on the associated device's queue.

Eliminate the possibility for blkdev_issue_discard to infinitely loop.

Interestingly this issue wasn't identified until a device, whose
discard_granularity was 0 due to read_capacity_16 overflow, was consumed
by blk_stack_limits() to construct limits for a higher-level DM
multipath device.  The multipath device's resulting limits never had the
discard limits stacked because blk_stack_limits() will only do so if
the bottom device's discard_granularity != 0.  This resulted in the
multipath device's limits.max_discard_sectors being 0.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
[Fixes Oracle BZ13779884]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk>
block/blk-lib.c