diff mbox

Use only specific errors when failing dm-ioctl

Message ID 1297877525-10163-1-git-send-email-mbroz@redhat.com (mailing list archive)
State Deferred, archived
Delegated to: Alasdair Kergon
Headers show

Commit Message

Milan Broz Feb. 16, 2011, 5:32 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 38e4eb1..ca19e4d 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -532,7 +532,17 @@  EXPORT_SYMBOL_GPL(dm_set_device_limits);
 int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
 		  struct dm_dev **result)
 {
-	return __table_get_device(ti->table, ti, path, mode, result);
+	int r = __table_get_device(ti->table, ti, path, mode, result);
+
+	/*
+	 * Return code is directly used for dm ioctl.
+	 * Allow only ENOMEM here, all other codes
+	 * means device lookup failed.
+	 */
+	if (r && r != -ENOMEM)
+		r = -ENXIO;
+
+	return r;
 }