qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature
@ 2014-08-11  5:43 Hitoshi Mitake
  2014-08-11  5:43 ` [Qemu-devel] [PATCH v3 1/2] sheepdog: adopting protocol update for VDI locking Hitoshi Mitake
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hitoshi Mitake @ 2014-08-11  5:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hitoshi Mitake, mitake.hitoshi

Recently, sheepdog revived VDI locking functionality. This patchset
updates sheepdog driver of QEMU for this feature.

v3:
 - keep backward compatibility

v2:
 - don't handle SD_RES_VDI_NOT_LOCKED as a special case   

Hitoshi Mitake (2):
  sheepdog: adopting protocol update for VDI locking
  sheepdog: improve error handling for a case of failed lock

 block/sheepdog.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH v3 1/2] sheepdog: adopting protocol update for VDI locking
  2014-08-11  5:43 [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature Hitoshi Mitake
@ 2014-08-11  5:43 ` Hitoshi Mitake
  2014-08-11  5:43 ` [Qemu-devel] [PATCH v3 2/2] sheepdog: improve error handling for a case of failed lock Hitoshi Mitake
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Hitoshi Mitake @ 2014-08-11  5:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, mitake.hitoshi, Hitoshi Mitake, MORITA Kazutaka,
	Stefan Hajnoczi, Liu Yuan

The update is required for supporting iSCSI multipath. It doesn't
affect behavior of QEMU driver but adding a new field to vdi request
struct is required.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Liu Yuan <namei.unix@gmail.com>
Cc: MORITA Kazutaka <morita.kazutaka@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
---
 block/sheepdog.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

v3:
 - keep backward compatibility

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 8d9350c..3da5ea2 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -103,6 +103,9 @@
 #define SD_INODE_SIZE (sizeof(SheepdogInode))
 #define CURRENT_VDI_ID 0
 
+#define LOCK_TYPE_NORMAL 0
+#define LOCK_TYPE_SHARED 1      /* for iSCSI multipath */
+
 typedef struct SheepdogReq {
     uint8_t proto_ver;
     uint8_t opcode;
@@ -166,7 +169,8 @@ typedef struct SheepdogVdiReq {
     uint8_t copy_policy;
     uint8_t reserved[2];
     uint32_t snapid;
-    uint32_t pad[3];
+    uint32_t type;
+    uint32_t pad[2];
 } SheepdogVdiReq;
 
 typedef struct SheepdogVdiRsp {
@@ -1090,6 +1094,7 @@ static int find_vdi_name(BDRVSheepdogState *s, const char *filename,
     memset(&hdr, 0, sizeof(hdr));
     if (lock) {
         hdr.opcode = SD_OP_LOCK_VDI;
+        hdr.type = LOCK_TYPE_NORMAL;
     } else {
         hdr.opcode = SD_OP_GET_VDI_INFO;
     }
@@ -1793,6 +1798,7 @@ static void sd_close(BlockDriverState *bs)
     memset(&hdr, 0, sizeof(hdr));
 
     hdr.opcode = SD_OP_RELEASE_VDI;
+    hdr.type = LOCK_TYPE_NORMAL;
     hdr.base_vdi_id = s->inode.vdi_id;
     wlen = strlen(s->name) + 1;
     hdr.data_length = wlen;
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH v3 2/2] sheepdog: improve error handling for a case of failed lock
  2014-08-11  5:43 [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature Hitoshi Mitake
  2014-08-11  5:43 ` [Qemu-devel] [PATCH v3 1/2] sheepdog: adopting protocol update for VDI locking Hitoshi Mitake
@ 2014-08-11  5:43 ` Hitoshi Mitake
  2014-08-14  7:49 ` [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature Liu Yuan
  2014-08-28  9:52 ` Stefan Hajnoczi
  3 siblings, 0 replies; 5+ messages in thread
From: Hitoshi Mitake @ 2014-08-11  5:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, mitake.hitoshi, Hitoshi Mitake, MORITA Kazutaka,
	Stefan Hajnoczi, Liu Yuan

Recently, sheepdog revived its VDI locking functionality. This patch
updates sheepdog driver of QEMU for this feature. It changes an error
code for a case of failed locking. -EBUSY is a suitable one.

Reported-by: Valerio Pachera <sirio81@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Liu Yuan <namei.unix@gmail.com>
Cc: MORITA Kazutaka <morita.kazutaka@gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
---
 block/sheepdog.c | 2 ++
 1 file changed, 2 insertions(+)

v2:
 - don't handle SD_RES_VDI_NOT_LOCKED as a special case   

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 3da5ea2..53f9d90 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1115,6 +1115,8 @@ static int find_vdi_name(BDRVSheepdogState *s, const char *filename,
                    sd_strerror(rsp->result), filename, snapid, tag);
         if (rsp->result == SD_RES_NO_VDI) {
             ret = -ENOENT;
+        } else if (rsp->result == SD_RES_VDI_LOCKED) {
+            ret = -EBUSY;
         } else {
             ret = -EIO;
         }
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature
  2014-08-11  5:43 [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature Hitoshi Mitake
  2014-08-11  5:43 ` [Qemu-devel] [PATCH v3 1/2] sheepdog: adopting protocol update for VDI locking Hitoshi Mitake
  2014-08-11  5:43 ` [Qemu-devel] [PATCH v3 2/2] sheepdog: improve error handling for a case of failed lock Hitoshi Mitake
@ 2014-08-14  7:49 ` Liu Yuan
  2014-08-28  9:52 ` Stefan Hajnoczi
  3 siblings, 0 replies; 5+ messages in thread
From: Liu Yuan @ 2014-08-14  7:49 UTC (permalink / raw)
  To: Hitoshi Mitake; +Cc: qemu-devel, mitake.hitoshi

On Mon, Aug 11, 2014 at 02:43:44PM +0900, Hitoshi Mitake wrote:
> Recently, sheepdog revived VDI locking functionality. This patchset
> updates sheepdog driver of QEMU for this feature.
> 
> v3:
>  - keep backward compatibility
> 
> v2:
>  - don't handle SD_RES_VDI_NOT_LOCKED as a special case   
> 
> Hitoshi Mitake (2):
>   sheepdog: adopting protocol update for VDI locking
>   sheepdog: improve error handling for a case of failed lock
> 
>  block/sheepdog.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 

Reviewed-by: Liu Yuan <namei.unix@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature
  2014-08-11  5:43 [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature Hitoshi Mitake
                   ` (2 preceding siblings ...)
  2014-08-14  7:49 ` [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature Liu Yuan
@ 2014-08-28  9:52 ` Stefan Hajnoczi
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2014-08-28  9:52 UTC (permalink / raw)
  To: Hitoshi Mitake; +Cc: qemu-devel, mitake.hitoshi

[-- Attachment #1: Type: text/plain, Size: 641 bytes --]

On Mon, Aug 11, 2014 at 02:43:44PM +0900, Hitoshi Mitake wrote:
> Recently, sheepdog revived VDI locking functionality. This patchset
> updates sheepdog driver of QEMU for this feature.
> 
> v3:
>  - keep backward compatibility
> 
> v2:
>  - don't handle SD_RES_VDI_NOT_LOCKED as a special case   
> 
> Hitoshi Mitake (2):
>   sheepdog: adopting protocol update for VDI locking
>   sheepdog: improve error handling for a case of failed lock
> 
>  block/sheepdog.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-28  9:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-11  5:43 [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature Hitoshi Mitake
2014-08-11  5:43 ` [Qemu-devel] [PATCH v3 1/2] sheepdog: adopting protocol update for VDI locking Hitoshi Mitake
2014-08-11  5:43 ` [Qemu-devel] [PATCH v3 2/2] sheepdog: improve error handling for a case of failed lock Hitoshi Mitake
2014-08-14  7:49 ` [Qemu-devel] [PATCH v3 0/2] sheepdog driver update related to VDI locking feature Liu Yuan
2014-08-28  9:52 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).