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

Konstantin Khorenko khorenko at virtuozzo.com
Fri Nov 19 18:54:41 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.30
------>
commit a00cd13d49d40f73c480ef3d2eff9db870ed6dbd
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Nov 19 18:54:40 2021 +0300

    dm-qcow2: Return empty string instead of -ENOENT in qcow2_get_img_name()
    
    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