diff mbox series

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

Message ID 20191206064731.283172-1-santosh@fossix.org (mailing list archive)
State Accepted
Commit a24b90c3cb1cfae5f6a03ac94d2716fa226ae790
Headers show
Series ndctl/zero-labels: Display error if regions are active | expand

Commit Message

Santosh Sivaraj Dec. 6, 2019, 6:47 a.m. UTC
Get zero-labels behave similar to init-labels.

Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
---
 ndctl/dimm.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Dan Williams Dec. 10, 2019, 7:05 p.m. UTC | #1
On Thu, Dec 5, 2019 at 10:48 PM Santosh Sivaraj <santosh@fossix.org> wrote:
>
> 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)."

>
> Signed-off-by: Santosh Sivaraj <santosh@fossix.org>

...otherwise, looks good, applied.
diff mbox series

Patch

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);
 }