From patchwork Tue Mar 25 23:48:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 3891441 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 637FABF540 for ; Tue, 25 Mar 2014 23:51:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A0F1201FD for ; Tue, 25 Mar 2014 23:51:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBBCF201BC for ; Tue, 25 Mar 2014 23:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751482AbaCYXvH (ORCPT ); Tue, 25 Mar 2014 19:51:07 -0400 Received: from mail-qc0-f201.google.com ([209.85.216.201]:41639 "EHLO mail-qc0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752035AbaCYXtM (ORCPT ); Tue, 25 Mar 2014 19:49:12 -0400 Received: by mail-qc0-f201.google.com with SMTP id c9so170038qcz.4 for ; Tue, 25 Mar 2014 16:49:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2cp1FGXKTFXkiqu6m+tE8jOfTBTBAUlA7RxKHIs2QlY=; b=asDQ6Uh7/IxGs1Gfc/7kW5zOIPAoYvH2SXeIREfKKjni/wczKf6hOXOdyc3ClJ1Lys OQJJvKiEvShjiD4PxUfPYynAIxgGp6oo7PiRc40XtamXxJZgVsKRRR0tN1adPnwqcT1S OeZd9GextaZGJtnVLlD1fyDmCka+d8+LsF/KP/EzflPfPFh4AqQ3N1caTSG3yPyDHUEi uJz4HovwbluOxE5bOQTkuRxRy0AhWCMVDzqCjhWx8aEe3u+s2QghMk8BgpCgeEvGaSSZ CqG+QiIVD0rHa2TXZG79IEzhnm8PBE/MWt7E22BXnbX2/eOOZ2+JHh3zH9kSQtRlHrx7 MFng== X-Gm-Message-State: ALoCoQmawbId8F07T/ShFpSTNWz7z144/85Q+54ocPSsUSbff6AXrZtH6l2y5mxszVUb6f5vpx9oVfckTtZQ7D7jHbECTFkLoUVqrBCr+bnk4iCk9XGQTsakGi+Oj7pJtllsKzBYl1ljQMZe8dwXp1BT6+0yLY5cF63ZcizUDUke+4ZYWncCpC/Ty93OLyk0zPqgnqMeuO74NsVAxMcPv3v7jfDJ3k/lyw== X-Received: by 10.58.111.202 with SMTP id ik10mr19525288veb.4.1395791351501; Tue, 25 Mar 2014 16:49:11 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id i30si1651035yhc.0.2014.03.25.16.49.11 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Mar 2014 16:49:11 -0700 (PDT) Received: from gwendal.mtv.corp.google.com (gwendal.mtv.corp.google.com [172.22.72.115]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 544EA5A4208; Tue, 25 Mar 2014 16:49:11 -0700 (PDT) Received: by gwendal.mtv.corp.google.com (Postfix, from userid 60833) id 14F49141CFA; Tue, 25 Mar 2014 16:49:11 -0700 (PDT) From: Gwendal Grignou To: axboe@kernel.dk, ulf.hansson@linaro.org Cc: linux-mtd@lists.infradead.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Gwendal Grignou Subject: [PATCH 1/4] Limit max_discard_sectors to UINT_MAX>>9 Date: Tue, 25 Mar 2014 16:48:23 -0700 Message-Id: <1395791307-23727-2-git-send-email-gwendal@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1395791307-23727-1-git-send-email-gwendal@chromium.org> References: <1395791307-23727-1-git-send-email-gwendal@chromium.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;