From patchwork Sat Jul 27 21:39:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 11062705 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 3B63B112C for ; Sat, 27 Jul 2019 21:54:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 320AE289CC for ; Sat, 27 Jul 2019 21:54:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 241A7289F2; Sat, 27 Jul 2019 21:54:17 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D95E0289CC for ; Sat, 27 Jul 2019 21:54:16 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 490D4212E2597; Sat, 27 Jul 2019 14:56:43 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=dan.j.williams@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 67E75212E259D for ; Sat, 27 Jul 2019 14:56:41 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jul 2019 14:54:14 -0700 X-IronPort-AV: E=Sophos;i="5.64,315,1559545200"; d="scan'208";a="254770049" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jul 2019 14:54:14 -0700 Subject: [ndctl PATCH v2 07/26] ndctl/namespace: Always zero info-blocks From: Dan Williams To: linux-nvdimm@lists.01.org Date: Sat, 27 Jul 2019 14:39:57 -0700 Message-ID: <156426359741.531577.6721558516702343422.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <156426356088.531577.14828880045306313118.stgit@dwillia2-desk3.amr.corp.intel.com> References: <156426356088.531577.14828880045306313118.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Do not gate zeroing on whether a namespace is claimed by a personality. The namespace might not have been able to be claimed due to info-block corruption. Signed-off-by: Dan Williams --- ndctl/namespace.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ndctl/namespace.c b/ndctl/namespace.c index 9eec313c2d5b..645aa14882bb 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -930,9 +930,6 @@ static int namespace_destroy(struct ndctl_region *region, struct ndctl_namespace *ndns) { const char *devname = ndctl_namespace_get_devname(ndns); - struct ndctl_pfn *pfn = ndctl_namespace_get_pfn(ndns); - struct ndctl_dax *dax = ndctl_namespace_get_dax(ndns); - struct ndctl_btt *btt = ndctl_namespace_get_btt(ndns); bool did_zero = false; int rc; @@ -954,13 +951,11 @@ static int namespace_destroy(struct ndctl_region *region, ndctl_namespace_set_enforce_mode(ndns, NDCTL_NS_MODE_RAW); - if (pfn || btt || dax) { - rc = zero_info_block(ndns); - if (rc < 0) - return rc; - if (rc == 0) - did_zero = true; - } + rc = zero_info_block(ndns); + if (rc < 0) + return rc; + if (rc == 0) + did_zero = true; switch (ndctl_namespace_get_type(ndns)) { case ND_DEVICE_NAMESPACE_PMEM: