Received: by 10.213.65.68 with SMTP id h4csp904229imn; Tue, 27 Mar 2018 10:55:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+XXemUVrocltEnKUeNXe/wotMXDxUFWJUbaiKulrl5pd5AKLcbiRN8JNBRsMUSqQZyt6VS X-Received: by 10.98.89.70 with SMTP id n67mr245277pfb.150.1522173312858; Tue, 27 Mar 2018 10:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173312; cv=none; d=google.com; s=arc-20160816; b=GDvtglCCrdE3QfX0WsbhkDwTvDh1Q/vOnI+ms3hhmcIEZbZHKmTuiejAgfMzueeO+S FimdPPu4370GephOLVaPx2l0lKk2VazBWcX3fMLD5dYE31YB8Hj9d+uEbSqGRJhjcpkV loG6s2W6ZrAZJ+z5NWcKHsoWnZIXuPambcrNm+a5BZ73iEXe/epGXzFGwrQtLWV01Ipx JZpiL8LjOZPZkUA4LpHpRfx8BOmVM3/yqrdML04uWviadic17rb5Pg5fDm0LxLRhASab HYOqSn85AcTqr+q+QAm7CJl1/KxKj3PFd045g5JhzhdeCdjm9bMJKi1xpJknQT8ulnoA qfaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=EBVsHoIHHpp7BuLzPvMZIWXwDgQIu+TkJq1BjwbAgpc=; b=PuM1PDQypepDjTLvX5PR7NX6E9xJQ+a9zRwkX10yuI2kqPlae2vHwjKF/WPOPzpaad KpIhqkGdTnJSoM11hzZDKwSZDgt2TTmvH1ZIHqfXNxk13aos+e7skV6iaNqsfkDx1qND koH3HLkee6qrVrYXqZ0NJ9/yZwmr9Df4cUtn/vyX+R9B8QkSv8t23hHSu7OpzzM2dYfJ 2cvKkuiPEoUmiOHkafFSs0b9/Wyk6yExZaf8fuXDiQ7u+xb/CQkHCuxJa4B5o1f9cZCM nWojK9z67kmQaeOnGE6hLIYf4AHfht9MuUbHuUdBisuNXykK3CRIHFbaBN0al/UYMJPI zt9w== ARC-Authentication-Results: i=1; mx.google.com; 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 n1-v6si1670054pld.692.2018.03.27.10.54.58; Tue, 27 Mar 2018 10:55:12 -0700 (PDT) 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; 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 S1753485AbeC0Qb4 (ORCPT + 99 others); Tue, 27 Mar 2018 12:31:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43110 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753471AbeC0Qbw (ORCPT ); Tue, 27 Mar 2018 12:31:52 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DD565EF9; Tue, 27 Mar 2018 16:31:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dariusz Dokupil , Vishal Verma , Dan Williams Subject: [PATCH 4.9 34/67] libnvdimm, {btt, blk}: do integrity setup before add_disk() Date: Tue, 27 Mar 2018 18:27:26 +0200 Message-Id: <20180327162728.876868121@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162726.702411083@linuxfoundation.org> References: <20180327162726.702411083@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vishal Verma commit 3ffb0ba9b567a8efb9a04ed3d1ec15ff333ada22 upstream. Prior to 25520d55cdb6 ("block: Inline blk_integrity in struct gendisk") we needed to temporarily add a zero-capacity disk before registering for blk-integrity. But adding a zero-capacity disk caused the partition table scanning to bail early, and this resulted in partitions not coming up after a probe of the BTT or blk namespaces. We can now register for integrity before the disk has been added, and this fixes the rescan problems. Fixes: 25520d55cdb6 ("block: Inline blk_integrity in struct gendisk") Reported-by: Dariusz Dokupil Cc: Signed-off-by: Vishal Verma Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/nvdimm/blk.c | 3 +-- drivers/nvdimm/btt.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) --- a/drivers/nvdimm/blk.c +++ b/drivers/nvdimm/blk.c @@ -286,8 +286,6 @@ static int nsblk_attach_disk(struct nd_n disk->queue = q; disk->flags = GENHD_FL_EXT_DEVT; nvdimm_namespace_disk_name(&nsblk->common, disk->disk_name); - set_capacity(disk, 0); - device_add_disk(dev, disk); if (devm_add_action_or_reset(dev, nd_blk_release_disk, disk)) return -ENOMEM; @@ -300,6 +298,7 @@ static int nsblk_attach_disk(struct nd_n } set_capacity(disk, available_disk_size >> SECTOR_SHIFT); + device_add_disk(dev, disk); revalidate_disk(disk); return 0; } --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -1392,8 +1392,6 @@ static int btt_blk_init(struct btt *btt) queue_flag_set_unlocked(QUEUE_FLAG_NONROT, btt->btt_queue); btt->btt_queue->queuedata = btt; - set_capacity(btt->btt_disk, 0); - device_add_disk(&btt->nd_btt->dev, btt->btt_disk); if (btt_meta_size(btt)) { int rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt)); @@ -1405,6 +1403,7 @@ static int btt_blk_init(struct btt *btt) } } set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9); + device_add_disk(&btt->nd_btt->dev, btt->btt_disk); btt->nd_btt->size = btt->nlba * (u64)btt->sector_size; revalidate_disk(btt->btt_disk);