Received: by 10.213.65.68 with SMTP id h4csp852689imn; Tue, 27 Mar 2018 09:59:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/766NQxMIpn0BaRQ2hiw0xtFZwWnk75ajTo8AC7Snq8EWlKgRKBpgPk0vQQi/68wM/1KtC X-Received: by 2002:a17:902:63:: with SMTP id 90-v6mr100550pla.125.1522169947341; Tue, 27 Mar 2018 09:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522169947; cv=none; d=google.com; s=arc-20160816; b=jDzWzEeLtniPlsM3uqoDOsdyfDbn16liLjWRdVH/Qv81i7Aa0MYaBzzoGzWDt164eo AjVPu16SdOSvu/EZGRIlOKwF98QVmODVF6MFTN09g9c25hIKMR9WrCxJu1GqhMi20/Mc F54dGil+ZaBr6JInnpxOB9IJZZO3+iH2rr5PNgSnmr45YaEmwbSrtIgpbZE6sgGO8mYP VEAcVJzRJdE3my5B8LYlI1ATjR+ca5RAfh6vsjJUrG7DnbvNvpruws9qs9orPwKxk7KT M46LF4o1AxJ9jYFpwCROo+idx0y31d6yEWviENEiDd2nmyWDScy7ZxlB2yQoApZg5Du+ X1HA== 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=3EgbXbwtRxWojjnWM0E/Lew8QahRumWhXFs0/RUZ63s=; b=e7MzyJR334Hk4OABdqul7B+tCx4ySpCScHH39vyGJ6Sqc1QkLKvaObCv2HFD330wZG 7gVHeVRONvV9oKR6FKE3V1zGnsH4e52DFEr/UevL4V2grbwC8ox+dSlYuLkZaeNMv3Uj TqCkB6tamqodW8eF0N9ZOmuaGD+JQJqNQh9/8lrQMKog/FdA9fanAGmsAwNRHITv1/3E iwfw6sEmzZSOcm4vvDRGOZyJOKWzgf8HJRLRbBQwwmwd8QUoSbZ0vGOXF80XB+iGe8fP 317UlCJQNAiSR0Fylec8JjLNb4sDKrV48toIol4qm8wQY1jrYRL3cFybTbj3O/RdOV8y /0dA== 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 1-v6si1619152plj.510.2018.03.27.09.58.52; Tue, 27 Mar 2018 09:59:07 -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 S932556AbeC0Qla (ORCPT + 99 others); Tue, 27 Mar 2018 12:41:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48720 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932536AbeC0QlZ (ORCPT ); Tue, 27 Mar 2018 12:41:25 -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 22B80F3F; Tue, 27 Mar 2018 16:41:24 +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.15 066/105] libnvdimm, {btt, blk}: do integrity setup before add_disk() Date: Tue, 27 Mar 2018 18:27:46 +0200 Message-Id: <20180327162801.824833796@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@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.15-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 @@ -278,8 +278,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; @@ -292,6 +290,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 @@ -1545,8 +1545,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)); @@ -1558,6 +1556,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);