From patchwork Wed Jul 24 16:26:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11057173 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4031813A0 for ; Wed, 24 Jul 2019 16:27:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FDC520243 for ; Wed, 24 Jul 2019 16:27:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2377C201CB; Wed, 24 Jul 2019 16:27:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBE7F201CB for ; Wed, 24 Jul 2019 16:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726242AbfGXQ1E (ORCPT ); Wed, 24 Jul 2019 12:27:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34452 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725882AbfGXQ1D (ORCPT ); Wed, 24 Jul 2019 12:27:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yNhGV6A1IPVP4ZHdx1ozA8WOlPpuWHgtt88D569y5bM=; b=DEJmM/V9hVWzSJqf25q7KhQxP Pee1MY0G7u9uHIQHf5iyK6QOyVcmz8IOxGCO07KMTpYF7rMymimxwAF8pCd2F2TfjJUY/Yi000Tsq D6C9l/Tu0iDaJijOsx6OYTdsGSKiSxmBSbc1YQmxnSo1Ppt1XyzqInUvKi0yJBrW9/yrbCRaGnf5X eYShlyPQgZ6/lzk4vS1ytGE0W4BEOUUzN0V8bvhRvWQLbutyWkqjwVOoUVjMBp8C6t4n4gOsRs9t3 gSB8w0D+ynQmHtNJYayRusbUwiHCgeM905OyIKoGcfqjmpT6olHq9t9DrLSbdQ7xjHJQoDOJ+Wr10 aPWA2tZLg==; Received: from [46.183.103.8] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hqK6W-00015Z-B0; Wed, 24 Jul 2019 16:27:00 +0000 From: Christoph Hellwig To: axboe@kernel.dk Cc: linux@roeck-us.net, James.Bottomley@HansenPartnership.com, linux-block@vger.kernel.org Subject: [PATCH] block: fix max segment size handling in blk_queue_virt_boundary Date: Wed, 24 Jul 2019 18:26:56 +0200 Message-Id: <20190724162656.3967-1-hch@lst.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We should only set the max segment size to unlimited if we actually have a virt boundary. Otherwise we accidentally clear that limit when called from the SCSI midlayer, which always calls blk_queue_virt_boundary, even if that mask is 0. Fixes: 7ad388d8e4c7 ("scsi: core: add a host / host template field for the virt boundary") Reported-by: Guenter Roeck Signed-off-by: Christoph Hellwig Reviewed-by: Bob Liu --- block/blk-settings.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index 2ae348c101a0..2c1831207a8f 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -752,7 +752,8 @@ void blk_queue_virt_boundary(struct request_queue *q, unsigned long mask) * page (which might not be idential to the Linux PAGE_SIZE). Because * of that they are not limited by our notion of "segment size". */ - q->limits.max_segment_size = UINT_MAX; + if (mask) + q->limits.max_segment_size = UINT_MAX; } EXPORT_SYMBOL(blk_queue_virt_boundary);