Message ID | 1395791307-23727-2-git-send-email-gwendal@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 2dc3b51..f30128b 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -859,7 +859,7 @@ static int __init nbd_init(void) */ queue_flag_set_unlocked(QUEUE_FLAG_NONROT, disk->queue); disk->queue->limits.discard_granularity = 512; - disk->queue->limits.max_discard_sectors = UINT_MAX; + disk->queue->limits.max_discard_sectors = UINT_MAX >> 9; disk->queue->limits.discard_zeroes_data = 0; blk_queue_max_hw_sectors(disk->queue, 65536); disk->queue->limits.max_sectors = 256;
max_discard_sectors can not be larger than UINT_MAX>>9, otherwise, there is a risk that discard requests would be merged into a request larger than 4GB. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> --- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)