Message ID | 158300763549.2141307.3591485336759056545.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=kIc1=4R=lists.01.org=linux-nvdimm-bounces@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14C421395 for <patchwork-linux-nvdimm@patchwork.kernel.org>; Sat, 29 Feb 2020 20:36:44 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EFA0420836 for <patchwork-linux-nvdimm@patchwork.kernel.org>; Sat, 29 Feb 2020 20:36:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EFA0420836 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 94A0410FC340B; Sat, 29 Feb 2020 12:37:35 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=dan.j.williams@intel.com; receiver=<UNKNOWN> Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 C68AF10FC3409 for <linux-nvdimm@lists.01.org>; Sat, 29 Feb 2020 12:37:32 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Feb 2020 12:36:40 -0800 X-IronPort-AV: E=Sophos;i="5.70,501,1574150400"; d="scan'208";a="257481253" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Feb 2020 12:36:40 -0800 Subject: [ndctl PATCH 06/36] ndctl/namespace: Fix destroy-namespace accounting relative to seed devices From: Dan Williams <dan.j.williams@intel.com> To: linux-nvdimm@lists.01.org Cc: vishal.l.verma@intel.com Date: Sat, 29 Feb 2020 12:20:35 -0800 Message-ID: <158300763549.2141307.3591485336759056545.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <158300760415.2141307.14060353322051900501.stgit@dwillia2-desk3.amr.corp.intel.com> References: <158300760415.2141307.14060353322051900501.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Message-ID-Hash: QLAMTSMBRCVVCEDY54GXLGPSTFYYBCKK X-Message-ID-Hash: QLAMTSMBRCVVCEDY54GXLGPSTFYYBCKK X-MailFrom: dan.j.williams@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." <linux-nvdimm.lists.01.org> Archived-At: <https://lists.01.org/hyperkitty/list/linux-nvdimm@lists.01.org/message/QLAMTSMBRCVVCEDY54GXLGPSTFYYBCKK/> List-Archive: <https://lists.01.org/hyperkitty/list/linux-nvdimm@lists.01.org/> List-Help: <mailto:linux-nvdimm-request@lists.01.org?subject=help> List-Post: <mailto:linux-nvdimm@lists.01.org> List-Subscribe: <mailto:linux-nvdimm-join@lists.01.org> List-Unsubscribe: <mailto:linux-nvdimm-leave@lists.01.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
Series |
Multiple topics / backlog for v68
|
expand
|
diff --git a/ndctl/namespace.c b/ndctl/namespace.c index 2f463509f8ca..994b4e8791ea 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -907,6 +907,7 @@ static int namespace_destroy(struct ndctl_region *region, 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); + unsigned long long size; bool did_zero = false; int rc; @@ -953,10 +954,19 @@ static int namespace_destroy(struct ndctl_region *region, goto out; } + size = ndctl_namespace_get_size(ndns); + rc = ndctl_namespace_delete(ndns); if (rc) debug("%s: failed to reclaim\n", devname); + /* + * Don't report a destroyed namespace when no capacity was + * allocated. + */ + if (size == 0 && rc == 0) + rc = 1; + out: return rc; }
Seed namespaces are included in "ndctl destroy-namespace all". However since the user never "creates" them it is surprising to see "destroy-namespace" report 1 more namespace relative to the number that have been created. Catch attempts to destroy a zero-sized namespace: Before: # ndctl create-namespace -s 500M { "dev":"namespace1.0", "size":"492.00 MiB (515.90 MB)", "blockdev":"pmem1" } # ndctl create-namespace -s 500M { "dev":"namespace1.1", "size":"492.00 MiB (515.90 MB)", "blockdev":"pmem1.1" } # ndctl create-namespace -s 500M { "dev":"namespace1.2", "size":"492.00 MiB (515.90 MB)", "blockdev":"pmem1.2" } # ndctl destroy-namespace -r 1 all -f destroyed 4 namespaces After: # ndctl create-namespace -s 500M { "dev":"namespace1.0", "size":"492.00 MiB (515.90 MB)", "blockdev":"pmem1" } # ndctl create-namespace -s 500M { "dev":"namespace1.3", "size":"492.00 MiB (515.90 MB)", "blockdev":"pmem1.3" } # ndctl create-namespace -s 500M { "dev":"namespace1.1", "size":"492.00 MiB (515.90 MB)", "blockdev":"pmem1.1" } # ndctl destroy-namespace -r 1 all -f destroyed 3 namespaces Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- ndctl/namespace.c | 10 ++++++++++ 1 file changed, 10 insertions(+)