[Qemu-devel] [PATCH] scsi-generic: Add share-rw option

Fam Zheng posted 1 patch 6 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20171205151553.7834-1-famz@redhat.com
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
hw/scsi/scsi-generic.c | 9 +++++++++
1 file changed, 9 insertions(+)
[Qemu-devel] [PATCH] scsi-generic: Add share-rw option
Posted by Fam Zheng 6 years, 4 months ago
Add the property to the device model, then parse it by calling
blkconf_apply_backend_options().

In addition to blk_set_perm(), the called function also handles error
options and wce. For error options we've already checked that the
default values are used, for wce we don't have the option either so it
is always the default (true). In other words there is no change of
behavior in these regards.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 hw/scsi/scsi-generic.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index bd0d9ff355..ba70c0dc19 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -482,6 +482,7 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp)
     int rc;
     int sg_version;
     struct sg_scsi_id scsiid;
+    Error *local_err = NULL;
 
     if (!s->conf.blk) {
         error_setg(errp, "drive property not set");
@@ -515,6 +516,13 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp)
         error_setg(errp, "SG_GET_SCSI_ID ioctl failed");
         return;
     }
+    blkconf_apply_backend_options(&s->conf,
+                                  blk_is_read_only(s->conf.blk),
+                                  true, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
+        return;
+    }
 
     /* define device state */
     s->type = scsiid.scsi_type;
@@ -565,6 +573,7 @@ static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
 
 static Property scsi_generic_properties[] = {
     DEFINE_PROP_DRIVE("drive", SCSIDevice, conf.blk),
+    DEFINE_PROP_BOOL("share-rw", SCSIDevice, conf.share_rw, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
2.14.3


Re: [Qemu-devel] [PATCH] scsi-generic: Add share-rw option
Posted by Fam Zheng 6 years, 4 months ago
On Tue, 12/05 23:15, Fam Zheng wrote:
> Add the property to the device model, then parse it by calling
> blkconf_apply_backend_options().
> 
> In addition to blk_set_perm(), the called function also handles error
> options and wce. For error options we've already checked that the
> default values are used, for wce we don't have the option either so it
> is always the default (true). In other words there is no change of
> behavior in these regards.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Ping? :)

Fam

Re: [Qemu-devel] [PATCH] scsi-generic: Add share-rw option
Posted by Paolo Bonzini 6 years, 4 months ago
On 20/12/2017 10:51, Fam Zheng wrote:
> On Tue, 12/05 23:15, Fam Zheng wrote:
>> Add the property to the device model, then parse it by calling
>> blkconf_apply_backend_options().
>>
>> In addition to blk_set_perm(), the called function also handles error
>> options and wce. For error options we've already checked that the
>> default values are used, for wce we don't have the option either so it
>> is always the default (true). In other words there is no change of
>> behavior in these regards.
>>
>> Signed-off-by: Fam Zheng <famz@redhat.com>
> 
> Ping? :)

Already queued.

Paolo

Re: [Qemu-devel] [PATCH] scsi-generic: Add share-rw option
Posted by Fam Zheng 6 years, 3 months ago
On Wed, 12/20 11:06, Paolo Bonzini wrote:
> On 20/12/2017 10:51, Fam Zheng wrote:
> > On Tue, 12/05 23:15, Fam Zheng wrote:
> >> Add the property to the device model, then parse it by calling
> >> blkconf_apply_backend_options().
> >>
> >> In addition to blk_set_perm(), the called function also handles error
> >> options and wce. For error options we've already checked that the
> >> default values are used, for wce we don't have the option either so it
> >> is always the default (true). In other words there is no change of
> >> behavior in these regards.
> >>
> >> Signed-off-by: Fam Zheng <famz@redhat.com>
> > 
> > Ping? :)
> 
> Already queued.
> 

But I think it was not in yesterday's PULL?

Fam

Re: [Qemu-devel] [PATCH] scsi-generic: Add share-rw option
Posted by Paolo Bonzini 6 years, 3 months ago
On 22/12/2017 02:54, Fam Zheng wrote:
> On Wed, 12/20 11:06, Paolo Bonzini wrote:
>> On 20/12/2017 10:51, Fam Zheng wrote:
>>> On Tue, 12/05 23:15, Fam Zheng wrote:
>>>> Add the property to the device model, then parse it by calling
>>>> blkconf_apply_backend_options().
>>>>
>>>> In addition to blk_set_perm(), the called function also handles error
>>>> options and wce. For error options we've already checked that the
>>>> default values are used, for wce we don't have the option either so it
>>>> is always the default (true). In other words there is no change of
>>>> behavior in these regards.
>>>>
>>>> Signed-off-by: Fam Zheng <famz@redhat.com>
>>>
>>> Ping? :)
>>
>> Already queued.
>>
> 
> But I think it was not in yesterday's PULL?

I confused it with the scsi-block one.

Paolo