1 Star 0 Fork 14

swf504/ndctl

forked from src-openEuler/ndctl 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-zero_info_block-skip-seed-devices.patch 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
lihaoxiang 提交于 2023-01-06 09:41 +08:00 . fix ndctl delete namespace exception
From fb13dfb8d84c4f0a749665c8f07179450b199f3e Mon Sep 17 00:00:00 2001
From: Jeff Moyer <jmoyer@redhat.com>
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 <yizhan@redhat.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/swf504/ndctl.git
git@gitee.com:swf504/ndctl.git
swf504
ndctl
ndctl
master

搜索帮助