Skip to contentSkip to conversation

ndctl/zero-labels: Display error if regions are active

PATCH In review Santosh Sivaraj 2 participants 2 messages Dec 6, 2019 – Dec 10, 2019 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ndctl/zero-labels: Display error if regions are active

Get zero-labels behave similar to init-labels.

---
 ndctl/dimm.c | 6 ++++++
 1 file changed, 6 insertions(+)
ndctl/dimm.c +6 -0
index b1b84c2..8b039fb 100644
@@ -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);
 }
 
Signature · 4 lines
2.23.0
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
#1 lore raw
Quoted 2 lines · Santosh Sivaraj

Get zero-labels behave similar to init-labels.

This changelog could be more precise. I'll fix this up to be.

"Make zero-labels behave the same as init-labels with respect to failing the operation while the DIMM is active (i.e. label area is busy)."

Quoted 2 lines

...otherwise, looks good, applied.
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]