Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3492681imu; Sun, 11 Nov 2018 16:19:59 -0800 (PST) X-Google-Smtp-Source: AJdET5cmJ0VSUmd5BRWyod4bL4be1919GTSFmfybAkkPDfqga7JY8OpzYGfee7NrYcHtD/LVp4XX X-Received: by 2002:a63:77ce:: with SMTP id s197mr15496260pgc.89.1541981999780; Sun, 11 Nov 2018 16:19:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981999; cv=none; d=google.com; s=arc-20160816; b=nrgYPCIJKxKkT662C8aWeB02wGwySOP4r4o3t+//BXmN9lvcXkiwUVGJnxaKkygreh pvLaIGv45my3kw9cp+YJlV3hkHziHuquWKyb5BnLDrhGDEj8NsDlL1cjf8EBEnAe8+m/ /2RLARpbsYQeZE283NDr2HTbsGoS9/+qKsQo501Lj5rc4xCq99pibcqkO9sUFVDX6/Hw fcrFy6lJdnZKMXUxhZoCNAvYedL0e48aezESAeAHTZd11XYe71CeVX3c/mb3VivlF1UT jTY134dyDIzuEXFgBUdFjTdWReBc1pDnoEAMdXlhD1FM9MLXbam1qEtiWq/bpUsxFPTw sSgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1GcdTZKUZGWfU9aAWY3UXqWXBN7Ba7qWtCoQPrTyLbQ=; b=SwQRz1qi4GWki90KmjJ6ZUsuj1oN3PioMX5DVVX8/VWewaslZQ5XYa4GmxBRiEJi4e xS/YJVn1D52IPLRnPWVL1loBcrK1KqsTp7xR5Q2cMJgQmdQR8jOhQ0wy6D+mIF1cfRkZ 9Bj4FSPgCrHNyV18O0tVIOkZkTllAspLTiTIFQ5g5SuDfJ7gCQKMEzAHgalTcBiAZW4L 5CryWZ8rZOPgXbWbkd2+nbAVTRluLwc61tCVAUNvS3VQg/Wx9SHSnEpE+NBMet9sCXA+ fdGNUXs0EDdU7A8eBSVl4hgkc7eJGhCcDafuzgIz/6qAR3PF69SIhQwd+NbLtz6reJgO FD9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZK6uhC+6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o68-v6si9908034pfb.269.2018.11.11.16.19.44; Sun, 11 Nov 2018 16:19:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZK6uhC+6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729894AbeKLIQz (ORCPT + 99 others); Mon, 12 Nov 2018 03:16:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:58618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729840AbeKLIQy (ORCPT ); Mon, 12 Nov 2018 03:16:54 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 30AB621527; Sun, 11 Nov 2018 22:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975219; bh=CuyEFBEWLYmhb94IMfLbUQJ5VmZwNoNhizxEjahO2S4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZK6uhC+6mFAYf3r0YPiiEgKGh51nxevkG+2/34nVAfOmcwLW97wJEzf5LqxEioZTD dIBGO10/NoN48adaAD5+CoKRk5jGofuKC2ikHe+NaWBg7uBzZRtggt6HbLH1RQ2oun NfXJeGSjLiKiXzxY9OJy4PfuNCF94YM1e2yUcDuQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Snitzer , Christoph Hellwig , Xiao Ni , Mariusz Dabrowski , Rui Salvaterra , Ming Lei , Jens Axboe Subject: [PATCH 4.19 020/361] block: make sure writesame bio is aligned with logical block size Date: Sun, 11 Nov 2018 14:16:07 -0800 Message-Id: <20181111221622.535130111@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ming Lei commit 34ffec60b27aa81d04e274e71e4c6ef740f75fc7 upstream. Obviously the created writesame bio has to be aligned with logical block size, and use bio_allowed_max_sectors() to retrieve this number. Cc: stable@vger.kernel.org Cc: Mike Snitzer Cc: Christoph Hellwig Cc: Xiao Ni Cc: Mariusz Dabrowski Fixes: b49a0871be31a745b2ef ("block: remove split code in blkdev_issue_{discard,write_same}") Tested-by: Rui Salvaterra Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -161,7 +161,7 @@ static int __blkdev_issue_write_same(str return -EOPNOTSUPP; /* Ensure that max_write_same_sectors doesn't overflow bi_size */ - max_write_same_sectors = UINT_MAX >> 9; + max_write_same_sectors = bio_allowed_max_sectors(q); while (nr_sects) { bio = next_bio(bio, 1, gfp_mask);