block/nfs: report errors from libnfs
authorPeter Lieven <pl@kamp.de>
Mon, 17 Mar 2014 08:37:21 +0000 (09:37 +0100)
committerKevin Wolf <kwolf@redhat.com>
Wed, 19 Mar 2014 08:39:41 +0000 (09:39 +0100)
if an NFS operation fails we should report what libnfs knows
about the failure. It is likely more than just an error code.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/nfs.c

index ef731f04e39c3de87d873dc96373653ab5f51b9b..98aa363e48d15fe49a3a8b8648ba4fd22fd75589 100644 (file)
@@ -112,6 +112,9 @@ nfs_co_generic_cb(int ret, struct nfs_context *nfs, void *data,
     if (task->ret == 0 && task->st) {
         memcpy(task->st, data, sizeof(struct stat));
     }
+    if (task->ret < 0) {
+        error_report("NFS Error: %s", nfs_get_error(nfs));
+    }
     if (task->co) {
         task->bh = qemu_bh_new(nfs_co_generic_bh_cb, task);
         qemu_bh_schedule(task->bh);