[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 14/27] sheepdog: Mark sd_snapshot_delete() lossage FI
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 14/27] sheepdog: Mark sd_snapshot_delete() lossage FIXME |
Date: |
Tue, 7 Mar 2017 16:40:38 +0100 |
From: Markus Armbruster <address@hidden>
sd_snapshot_delete() should delete the snapshot whose ID matches
@snapshot_id and whose name matches @name. But that's not what it
does. If @snapshot_id is a valid ID, it deletes the snapshot with
that ID, else it deletes the snapshot with that name. It doesn't use
@name at all. Add suitable FIXME comments, so someone who actually
knows Sheepdog can fix it.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/sheepdog.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index be3db1f..187bcd8 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2457,6 +2457,10 @@ static int sd_snapshot_delete(BlockDriverState *bs,
const char *name,
Error **errp)
{
+ /*
+ * FIXME should delete the snapshot matching both @snapshot_id and
+ * @name, but @name not used here
+ */
unsigned long snap_id = 0;
char snap_tag[SD_MAX_VDI_TAG_LEN];
int fd, ret;
@@ -2481,6 +2485,11 @@ static int sd_snapshot_delete(BlockDriverState *bs,
pstrcpy(buf, SD_MAX_VDI_LEN, s->name);
ret = qemu_strtoul(snapshot_id, NULL, 10, &snap_id);
if (ret || snap_id > UINT32_MAX) {
+ /*
+ * FIXME Since qemu_strtoul() returns -EINVAL when
+ * @snapshot_id is null, @snapshot_id is mandatory. Correct
+ * would be to require at least one of @snapshot_id and @name.
+ */
error_setg(errp, "Invalid snapshot ID: %s",
snapshot_id ? snapshot_id : "<null>");
return -EINVAL;
@@ -2489,6 +2498,7 @@ static int sd_snapshot_delete(BlockDriverState *bs,
if (snap_id) {
hdr.snapid = (uint32_t) snap_id;
} else {
+ /* FIXME I suspect we should use @name here */
pstrcpy(snap_tag, sizeof(snap_tag), snapshot_id);
pstrcpy(buf + SD_MAX_VDI_LEN, SD_MAX_VDI_TAG_LEN, snap_tag);
}
--
1.8.3.1
- [Qemu-block] [PULL 02/27] mirror: Fix permission problem with 'replaces', (continued)
- [Qemu-block] [PULL 02/27] mirror: Fix permission problem with 'replaces', Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 05/27] block: Fix blockdev-snapshot error handling, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 04/27] mirror: Fix error path for dirty bitmap creation, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 07/27] block: Factor out bdrv_replace_child_noperm(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 06/27] block: Factor out should_update_child(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 08/27] block: Ignore multiple children in bdrv_check_update_perm(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 11/27] sheepdog: Defuse time bomb in sd_open() error handling, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 09/27] block: Handle permission errors in change_parent_backing_link(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 10/27] block: Fix error handling in bdrv_replace_in_backing_chain(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 13/27] sheepdog: Fix error handling sd_create(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 14/27] sheepdog: Mark sd_snapshot_delete() lossage FIXME,
Kevin Wolf <=
- [Qemu-block] [PULL 12/27] sheepdog: Fix error handling in sd_snapshot_delete(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 15/27] sheepdog: Fix snapshot ID parsing in _open(), _create, _goto(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 16/27] sheepdog: Don't truncate long VDI name in _open(), _create(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 19/27] sheepdog: Implement bdrv_parse_filename(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 17/27] sheepdog: Report errors in pseudo-filename more usefully, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 18/27] sheepdog: Use SocketAddress and socket_connect(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 20/27] gluster: Drop assumptions on SocketTransport names, Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 21/27] gluster: Don't duplicate qapi-util.c's qapi_enum_parse(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 22/27] gluster: Plug memory leaks in qemu_gluster_parse_json(), Kevin Wolf, 2017/03/07
- [Qemu-block] [PULL 25/27] sheepdog: Support blockdev-add, Kevin Wolf, 2017/03/07