qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v8 14/36] scsi-generic: Apply lock-mode when realize


From: Fam Zheng
Subject: [Qemu-devel] [PATCH v8 14/36] scsi-generic: Apply lock-mode when realize
Date: Fri, 30 Sep 2016 20:09:44 +0800

Signed-off-by: Fam Zheng <address@hidden>
---
 hw/scsi/scsi-generic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 7a588a7..4f131e8 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -502,12 +502,19 @@ static void scsi_generic_realize(SCSIDevice *s, Error 
**errp)
     int rc;
     int sg_version;
     struct sg_scsi_id scsiid;
+    Error *err = NULL;
 
     if (!s->conf.blk) {
         error_setg(errp, "drive property not set");
         return;
     }
 
+    blk_lock_image(s->conf.blk, s->conf.lock_mode, &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
+
     if (blk_get_on_error(s->conf.blk, 0) != BLOCKDEV_ON_ERROR_ENOSPC) {
         error_setg(errp, "Device doesn't support drive option werror");
         return;
-- 
2.7.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]