Skip to contentSkip to conversation

sheepdog: Fix misleading error messages in sd_snapshot_create()

PATCH Applied Markus Armbruster 4 participants 5 messages Feb 12, 2015 – Mar 4, 2015 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sheepdog: Fix misleading error messages in sd_snapshot_create()

If do_sd_create() fails, it first reports the error returned, then reports a another one with strerror(errno). errno is meaningless at that point.

Report just one error combining the valid information from both messages.

---
Applies on top of my "[PATCH v2 00/10] Clean up around error_get_pretty(), qerror_report_err()", but rebasing to master would be trivial.

 block/sheepdog.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
block/sheepdog.c +2 -3
index 6a4a3bd..0e8c712 100644
@@ -2225,9 +2225,8 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
 
     ret = do_sd_create(s, &new_vid, 1, &local_err);
     if (ret < 0) {
-        error_report_err(local_err);
-        error_report("failed to create inode for snapshot. %s",
-                     strerror(errno));
+        error_report("failed to create inode for snapshot: %s",
+                     error_get_pretty(local_err));
         goto cleanup;
     }
 
Signature · 1 line
1.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Markus Armbruster

If do_sd_create() fails, it first reports the error returned, then reports a another one with strerror(errno). errno is meaningless at that point.

Report just one error combining the valid information from both messages.

Quoted 7 lines

---
Applies on top of my "[PATCH v2 00/10] Clean up around error_get_pretty(), qerror_report_err()", but rebasing to master would be trivial.

 block/sheepdog.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Reviewed-by on v1 1/1
#2 lore raw
In reply to Markus Armbruster
Quoted 22 lines · Markus Armbruster

If do_sd_create() fails, it first reports the error returned, then reports a another one with strerror(errno). errno is meaningless at that point.

Report just one error combining the valid information from both messages.

---
Applies on top of my "[PATCH v2 00/10] Clean up around error_get_pretty(), qerror_report_err()", but rebasing to master would be trivial.

 block/sheepdog.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
block/sheepdog.c +0 -0
index 6a4a3bd..0e8c712 100644

block/sheepdog.c static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) · line 2231

Quoted 10 lines
block/sheepdog.c +2 -3
@@ -2225,9 +2225,8 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
 
     ret = do_sd_create(s, &new_vid, 1, &local_err);
     if (ret < 0) {
-        error_report_err(local_err);
-        error_report("failed to create inode for snapshot. %s",
-                     strerror(errno));
+        error_report("failed to create inode for snapshot: %s",
+                     error_get_pretty(local_err));
         goto cleanup;
     }
#3 lore raw
In reply to Markus Armbruster
Quoted 7 lines · Markus Armbruster

If do_sd_create() fails, it first reports the error returned, then reports a another one with strerror(errno). errno is meaningless at that point.

Report just one error combining the valid information from both messages.

Quoted 6 lines

---
Applies on top of my "[PATCH v2 00/10] Clean up around error_get_pretty(), qerror_report_err()", but rebasing to master would be trivial.

Applies cleanly on master now. Maintainers, please apply.

Applied
#4 lore raw
In reply to Markus Armbruster

Am 12.02.2015 um 14:49 hat Markus Armbruster geschrieben:

Quoted 9 lines

If do_sd_create() fails, it first reports the error returned, then reports a another one with strerror(errno). errno is meaningless at that point.

Report just one error combining the valid information from both messages.

Thanks, applied to the block branch.

Kevin