sheepdog driver update related to VDI locking feature
v2 cover sheepdog driver update related to VDI locking feature
Recently, sheepdog revived VDI locking functionality. This patchset updates sheepdog driver of QEMU for this feature.
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(-)
Signature · 1 line
1.8.3.2
PATCH v2 1/2 sheepdog: adopting protocol update for VDI locking
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.
--- block/sheepdog.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
block/sheepdog.c +7 -1
@@ -103,6 +103,9 @@#define SD_INODE_SIZE (sizeof(SheepdogInode))#define CURRENT_VDI_ID 0 +#define LOCK_TYPE_NORMAL 1 +#define LOCK_TYPE_SHARED 2/* 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;
Signature · 1 line
1.8.3.2
PATCH v2 2/2 sheepdog: improve error handling for a case of failed lock
In reply to Hitoshi MitakeRecently, 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.
---
v2:
- don't handle SD_RES_VDI_NOT_LOCKED as a special case
block/sheepdog.c | 2 ++ 1 file changed, 2 insertions(+)
block/sheepdog.c +2 -0
@@ -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 ; }
Signature · 1 line
1.8.3.2