Patchwork qcow2: fix the return value -ENOENT -> -EEXIST

login
register
mail settings
Submitter Zhiyong Wu
Date April 26, 2012, 8:11 a.m.
Message ID <1335427897-20685-1-git-send-email-zwu.kernel@gmail.com>
Download mbox | patch
Permalink /patch/155184/
State New
Headers show

Comments

Zhiyong Wu - April 26, 2012, 8:11 a.m.
From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 block/qcow2-snapshot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Stefan Hajnoczi - April 26, 2012, 9:27 a.m.
On Thu, Apr 26, 2012 at 9:11 AM,  <zwu.kernel@gmail.com> wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> ---
>  block/qcow2-snapshot.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Checked that no callers depend on -ENOENT.  Looks good.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Kevin Wolf - April 26, 2012, 9:42 a.m.
Am 26.04.2012 11:27, schrieb Stefan Hajnoczi:
> On Thu, Apr 26, 2012 at 9:11 AM,  <zwu.kernel@gmail.com> wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> ---
>>  block/qcow2-snapshot.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> Checked that no callers depend on -ENOENT.  Looks good.
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

Thanks, applied to the block branch.

Kevin
Zhiyong Wu - April 26, 2012, 1:39 p.m.
On Thu, Apr 26, 2012 at 5:27 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Thu, Apr 26, 2012 at 9:11 AM,  <zwu.kernel@gmail.com> wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> ---
>>  block/qcow2-snapshot.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> Checked that no callers depend on -ENOENT.  Looks good.
>
> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

indeed thanks for your review.

Patch

diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 42f971b..4561a2a 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -331,7 +331,7 @@  int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
 
     /* Check that the ID is unique */
     if (find_snapshot_by_id(bs, sn_info->id_str) >= 0) {
-        return -ENOENT;
+        return -EEXIST;
     }
 
     /* Populate sn with passed data */