diff mbox

[ndctl,1/7] ndctl, create-namespace: report failures due to namespace being mounted

Message ID 146161379487.21779.8389169524298318569.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 5251988630d4
Headers show

Commit Message

Dan Williams April 25, 2016, 7:49 p.m. UTC
In the case when a filesystem is mounted on a namespace targeted for
reconfiguration or destruction, emit a message so the user knows to
unmount the filesystem, or otherwise communicate why ndctl could not
exclusively open the device for writing.

Reported-by: Linda Knippers <linda.knippers@hpe.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 builtin-xaction-namespace.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/builtin-xaction-namespace.c b/builtin-xaction-namespace.c
index 1f25cc18f5a2..97bb36525d7c 100644
--- a/builtin-xaction-namespace.c
+++ b/builtin-xaction-namespace.c
@@ -553,7 +553,9 @@  static int namespace_destroy(struct ndctl_region *region,
 			 * stopping the !bdev case from racing to mount an fs or
 			 * re-enabling the namepace.
 			 */
-			return -EBUSY;
+			error("%s: %s failed exlusive open: %s\n",
+					devname, bdev, strerror(errno));
+			return -errno;
 		}
 	}