Get zero-labels behave similar to init-labels.

Signed-off-by: Santosh Sivaraj <[email protected]>
---
 ndctl/dimm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ndctl/dimm.c b/ndctl/dimm.c
index b1b84c2..8b039fb 100644
--- a/ndctl/dimm.c
+++ b/ndctl/dimm.c
@@ -80,6 +80,12 @@ static int action_enable(struct ndctl_dimm *dimm, struct 
action_context *actx)
 
 static int action_zero(struct ndctl_dimm *dimm, struct action_context *actx)
 {
+       if (ndctl_dimm_is_active(dimm)) {
+               fprintf(stderr, "%s: regions active, abort label write\n",
+                       ndctl_dimm_get_devname(dimm));
+               return -EBUSY;
+       }
+
        return ndctl_dimm_zero_label_extent(dimm, param.len, param.offset);
 }
 
-- 
2.23.0
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to