block/iscsi: return -ENOMEM if an async call fails immediately
PATCH 1/1 block/iscsi: return -ENOMEM if an async call fails immediately
if an async libiscsi call fails directly it can only be due to an out of memory condition. All other errors are returned through the callback.
Signed-off-by Peter Lieven <[email protected]>
--- block/iscsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
block/iscsi.c +6 -6
@@ -308,7 +308,7 @@ retry: iscsi_co_generic_cb, &iTask);if (iTask.task ==NULL ) {g_free (buf); -return -EIO ; +return -ENOMEM ; }#if defined(LIBISCSI_FEATURE_IOVECTOR ) scsi_task_set_iov_out(iTask.task, (struct scsi_iovec *) iov->iov,
@@ -376,7 +376,7 @@ retry:break ; }if (iTask.task ==NULL ) { -return -EIO ; +return -ENOMEM ; }#if defined(LIBISCSI_FEATURE_IOVECTOR )scsi_task_set_iov_in (iTask.task, (struct scsi_iovec *) iov->iov, iov->niov);
@@ -419,7 +419,7 @@ static int coroutine_fn iscsi_co_flush(BlockDriverState *bs) retry:if (iscsi_synchronizecache10_task (iscsilun->iscsi, iscsilun->lun,0 ,0 ,0 ,0 , iscsi_co_generic_cb, &iTask) ==NULL ) { -return -EIO ; +return -ENOMEM ; }while (!iTask.complete) {
@@ -669,7 +669,7 @@ retry: sector_qemu2lun(sector_num, iscsilun), 8 + 16, iscsi_co_generic_cb, &iTask) == NULL) { - ret = -EIO ; + ret = -ENOMEM ; goto out; }
@@ -753,7 +753,7 @@ coroutine_fn iscsi_co_discard(BlockDriverState *bs, int64_t sector_num, retry:if (iscsi_unmap_task (iscsilun->iscsi, iscsilun->lun,0 ,0 , &list,1 , iscsi_co_generic_cb, &iTask) ==NULL ) { -return -EIO ; +return -ENOMEM ; }while (!iTask.complete) {
@@ -822,7 +822,7 @@ retry: iscsilun->zeroblock, iscsilun->block_size, nb_blocks, 0, !!(flags & BDRV_REQ_MAY_UNMAP), 0, 0, iscsi_co_generic_cb, &iTask) == NULL) { -return -EIO ; +return -ENOMEM ; }while (!iTask.complete) {
Signature · 1 line
1.7.9.5
Looks good.
Reviewed-by Ronnie Sahlberg <[email protected]>
Quoted 70 lines · Peter Lieven
if an async libiscsi call fails directly it can only be due to an out of memory condition. All other errors are returned through the callback.
Signed-off-by Peter Lieven <[email protected]>--- block/iscsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)block/iscsi.c +6
-7@@ -308,7 +308,7 @@ retry: iscsi_co_generic_cb, &iTask);if (iTask.task ==NULL ) {g_free (buf); -return -EIO ; +return -ENOMEM ; }#if defined(LIBISCSI_FEATURE_IOVECTOR ) scsi_task_set_iov_out(iTask.task, (struct scsi_iovec *) iov->iov,@@ -376,7 +376,7 @@ retry:break ; }if (iTask.task ==NULL ) { -return -EIO ; +return -ENOMEM ; }#if defined(LIBISCSI_FEATURE_IOVECTOR )scsi_task_set_iov_in (iTask.task, (struct scsi_iovec *) iov->iov, iov->niov);@@ -419,7 +419,7 @@ static int coroutine_fn iscsi_co_flush(BlockDriverState *bs) retry:if (iscsi_synchronizecache10_task (iscsilun->iscsi, iscsilun->lun,0 ,0 ,0 ,0 , iscsi_co_generic_cb, &iTask) ==NULL ) { -return -EIO ; +return -ENOMEM ; }while (!iTask.complete) {@@ -669,7 +669,7 @@ retry: sector_qemu2lun(sector_num, iscsilun), 8 + 16, iscsi_co_generic_cb, &iTask) == NULL) { - ret = -EIO ; + ret = -ENOMEM ; goto out; }@@ -753,7 +753,7 @@ coroutine_fn iscsi_co_discard(BlockDriverState *bs, int64_t sector_num, retry:if (iscsi_unmap_task (iscsilun->iscsi, iscsilun->lun,0 ,0 , &list,1 , iscsi_co_generic_cb, &iTask) ==NULL ) { -return -EIO ; +return -ENOMEM ; }while (!iTask.complete) {@@ -822,7 +822,7 @@ retry: iscsilun->zeroblock, iscsilun->block_size, nb_blocks, 0, !!(flags & BDRV_REQ_MAY_UNMAP), 0, 0, iscsi_co_generic_cb, &iTask) == NULL) { -return -EIO ; +return -ENOMEM ; }while (!iTask.complete) { --1.7.9.5
Stefan Hajnoczi
AppliedQuoted 8 lines · Peter Lieven
if an async libiscsi call fails directly it can only be due to an out of memory condition. All other errors are returned through the callback.
Signed-off-by Peter Lieven <[email protected]>--- block/iscsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next
Stefan