From patchwork Sat Apr 22 21:22:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 9694491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 15EFB601E9 for ; Sat, 22 Apr 2017 21:22:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECE142621D for ; Sat, 22 Apr 2017 21:22:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF8A827F89; Sat, 22 Apr 2017 21:22:15 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 445E62621D for ; Sat, 22 Apr 2017 21:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1426709AbdDVVWO (ORCPT ); Sat, 22 Apr 2017 17:22:14 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:35795 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1426693AbdDVVWN (ORCPT ); Sat, 22 Apr 2017 17:22:13 -0400 Received: by mail-qk0-f195.google.com with SMTP id k139so16665951qke.2 for ; Sat, 22 Apr 2017 14:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hnb5JgCcpoyMchv00WYTIUldS2oGmzZ68MEUS3O7MhU=; b=JeGI93FgY+NMPBkzWbO4Q9w3k9YT9OZtySfmYij0EqukU2JNd97C5ZLsPguGYRzDiZ sJCkYWHncUeqnBmwb5/MM+L+YjFxq5gPI0pKevUTo2On5ZX2Ovvn5Rd9Cl7k1FfsU1rm tTlLVPpcrrNlJsoM5pRuu/SMuS8stB5QshXIdcUXAnw/lfdGl1SYURRCF8yUzZ4nvq/z KuJkhCq1ihWeiFyhPpG+/mcksu+fF2HBqZKjWtQXCCJbBnpBfaOZxBH++K9bruBqp2Cn 6ElclwuGQaOkECtGxi0NpBlZFcWnlUVVxECxyImy9YJLnd6Y4UQNxOv5Kx0nKdq7UloG B1VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=hnb5JgCcpoyMchv00WYTIUldS2oGmzZ68MEUS3O7MhU=; b=qcAoWnxTgK2YlobySOrJD17+M/gG1by6pWJ/ttifziwcXP9a569/aLNilMf4ayKhve priyIaMP2o/sQWeG/5nErr5ZetLwXPh76LUAbDddBJKn67Dpv8feFKg/fPP76cpQLMR0 uEA77kvem3xY50OKZnxgy9ODabIbXDQJhYXO45HHCD1GZGuryYofSuzvA6g5/PXgtA8u IKl1WrpUklfbaVTg2mYRapuA72M5OFQ1v3TLUJR+L0EhzdGApjNVa6FGGlpdYK1F2dhf MQGKIpLwRf98Ta19a9pqTpBXmxRv+him34Mkh0yPJC3sOY5NknP2iiVRhBTabQds7ojb DcvA== X-Gm-Message-State: AN3rC/7wjwfp5HmM0j61utptip/4+C1WbuPpP/3bd5rH5kiich3hlJML y2NnPQ/EBRGN2Q== X-Received: by 10.55.147.67 with SMTP id v64mr17709643qkd.39.1492896132201; Sat, 22 Apr 2017 14:22:12 -0700 (PDT) Received: from localhost (c-71-233-59-67.hsd1.ma.comcast.net. [71.233.59.67]) by smtp.gmail.com with ESMTPSA id 123sm9342150qkm.22.2017.04.22.14.22.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Apr 2017 14:22:10 -0700 (PDT) Date: Sat, 22 Apr 2017 17:22:09 -0400 From: Mike Snitzer To: Jens Axboe , "Martin K. Petersen" Cc: dm-devel@redhat.com, linux-block@vger.kernel.org, Mikulas Patocka Subject: [PATCH v2 for-4.12] block: fix blk_integrity_register to use template's interval_exp if not 0 Message-ID: <20170422212209.GA49088@redhat.com> References: <20170421222815.45663-1-snitzer@redhat.com> <20170422151043.GA22651@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170422151043.GA22651@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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 When registering an integrity profile: if the template's interval_exp is not 0 use it, otherwise use the ilog2() of logical block size of the provided gendisk. This fixes a long-standing DM linear target bug where it cannot pass integrity data to the underlying device if its logical block size conflicts with the underlying device's logical block size. Cc: stable@vger.kernel.org Reported-by: Mikulas Patocka Signed-off-by: Mike Snitzer Acked-by: Martin K. Petersen --- block/blk-integrity.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Jens, please feel free to pick this up for 4.12 and I'll just make the dm-integrity commit Depends-on it once you've staged it. diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 9f0ff5b..d6e1b9a 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -412,7 +412,8 @@ void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template bi->flags = BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE | template->flags; - bi->interval_exp = ilog2(queue_logical_block_size(disk->queue)); + bi->interval_exp = template->interval_exp ? : + ilog2(queue_logical_block_size(disk->queue)); bi->profile = template->profile ? template->profile : &nop_profile; bi->tuple_size = template->tuple_size; bi->tag_size = template->tag_size;