The return codes of ioctl are part of device-mapper API and only defined errno should be returned. Unify return codes for device lookup function on one place and allow ENOMEM and ENXIO for now. (Later it can be added more codes as userspace is prepared to handle them.) Signed-off-by: Milan Broz <mbroz@xxxxxxxxxx> --- drivers/md/dm-table.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) 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; } -- 1.7.2.3 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel