diff --git a/0002-zero_info_block-skip-seed-devices.patch b/0002-zero_info_block-skip-seed-devices.patch new file mode 100644 index 0000000000000000000000000000000000000000..ca07457d68f137e2c06d41407af56f7a52baa359 --- /dev/null +++ b/0002-zero_info_block-skip-seed-devices.patch @@ -0,0 +1,49 @@ +From fb13dfb8d84c4f0a749665c8f07179450b199f3e Mon Sep 17 00:00:00 2001 +From: Jeff Moyer +Date: Tue, 9 Feb 2021 16:51:53 -0500 +Subject: [PATCH] zero_info_block: skip seed devices + +Currently, ndctl destroy-namespace -f all will output errors of the +form: + + Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing + +for any zero-sized namespace. That particular namespace looks like this: + + { + "dev":"namespace0.0", + "mode":"raw", + "size":0, + "uuid":"00000000-0000-0000-0000-000000000000", + "sector_size":512, + "state":"disabled" + } + +This patch skips over namespaces with size=0 when zeroing out info +blocks. + +Fixes: 46654c2d60b70 ("ndctl/namespace: Always zero info-blocks") +Reported-by: Zhang Yi +Signed-off-by: Jeff Moyer +Signed-off-by: Vishal Verma +Link: https://lore.kernel.org/r/x49r1lohpty.fsf@segfault.boston.devel.redhat.com +--- + ndctl/namespace.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/ndctl/namespace.c b/ndctl/namespace.c +index 1feb74d..1e8a2cd 100644 +--- a/ndctl/namespace.c ++++ b/ndctl/namespace.c +@@ -1052,6 +1052,9 @@ static int zero_info_block(struct ndctl_namespace *ndns) + void *buf = NULL, *read_buf = NULL; + char path[50]; + ++ if (ndctl_namespace_get_size(ndns) == 0) ++ return 1; ++ + ndctl_namespace_set_raw_mode(ndns, 1); + rc = ndctl_namespace_enable(ndns); + if (rc < 0) { +-- +2.37.0.windows.1 \ No newline at end of file diff --git a/ndctl.spec b/ndctl.spec index 00d0eba85ebbc5d95896a9133675916109480c99..d3318a53388ab8c0a84b4bae01ba2f0da3731888 100644 --- a/ndctl.spec +++ b/ndctl.spec @@ -1,6 +1,6 @@ Name: ndctl Version: 71.1 -Release: 4 +Release: 5 Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory) License: GPL-2, LGPL-2.1, MIT, CC0-1.0 Group: System Environment/Base @@ -8,6 +8,7 @@ Url: https://github.com/pmem/ndctl Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Patch1: 0001-ndctl-test-Fix-device-dax-mremap-test.patch +Patch2: 0002-zero_info_block-skip-seed-devices.patch Requires: ndctl-libs%{?_isa} = %{version}-%{release} Requires: daxctl-libs%{?_isa} = %{version}-%{release} @@ -154,6 +155,9 @@ make check %changelog +* Fri Jan 6 2023 lihaoxiang - 71.1-5 +- fix ndctl delete namespace exception + * Thu Oct 20 2022 liusirui - 71.1-4 - backport patch to fix test case