[Devel] [PATCH RH9] dm-qcow2: Return empty string instead of -ENOENT in qcow2_get_img_name()

Kirill Tkhai ktkhai at virtuozzo.com
Fri Nov 19 17:38:54 MSK 2021


This is unification with ploop.

https://jira.sw.ru/browse/PSBM-136241
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-qcow2-cmd.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-qcow2-cmd.c b/drivers/md/dm-qcow2-cmd.c
index ee4f4a43ad80..458a2d5d71e4 100644
--- a/drivers/md/dm-qcow2-cmd.c
+++ b/drivers/md/dm-qcow2-cmd.c
@@ -272,8 +272,10 @@ static int qcow2_get_img_name(struct qcow2_target *tgt, u32 img_id,
 		skip--;
 	}
 
-	if (!qcow2 || skip)
-		return -ENOENT;
+	if (!qcow2 || skip) {
+		result[0] = 0; /* empty output */
+		return 1;
+	}
 
 	p = file_path(qcow2->file, result, maxlen - 1);
 	if (IS_ERR(p)) {




More information about the Devel mailing list