Patchwork [3/5] iscsi: do not assume device is zero initialized

login
register
mail settings
Submitter Paolo Bonzini
Date Nov. 28, 2012, 3:21 p.m.
Message ID <1354116110-28651-4-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/202486/
State New
Headers show

Comments

Paolo Bonzini - Nov. 28, 2012, 3:21 p.m.
From: Peter Lieven <pl@dlhnet.de>

Without any complex checks we can't assume that an
iscsi target is initialized to zero.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/iscsi.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/block/iscsi.c b/block/iscsi.c
index 01340e1..c0b70b3 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -951,6 +951,11 @@  static void iscsi_close(BlockDriverState *bs)
     memset(iscsilun, 0, sizeof(IscsiLun));
 }
 
+static int iscsi_has_zero_init(BlockDriverState *bs)
+{
+    return 0;
+}
+
 static BlockDriver bdrv_iscsi = {
     .format_name     = "iscsi",
     .protocol_name   = "iscsi",
@@ -966,6 +971,7 @@  static BlockDriver bdrv_iscsi = {
     .bdrv_aio_flush  = iscsi_aio_flush,
 
     .bdrv_aio_discard = iscsi_aio_discard,
+    .bdrv_has_zero_init = iscsi_has_zero_init,
 
 #ifdef __linux__
     .bdrv_ioctl       = iscsi_ioctl,