[Sheepdog] [PATCH] collie: release vdi lock when qemu died with its host machine
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Sun Apr 18 00:46:03 CEST 2010
At Sun, 18 Apr 2010 04:16:07 +0900,
MORITA Kazutaka wrote:
>
> Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> ---
> collie/group.c | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/collie/group.c b/collie/group.c
> index f3bef66..f2ec7a9 100644
> --- a/collie/group.c
> +++ b/collie/group.c
> @@ -1050,6 +1050,17 @@ static void __sd_confch(struct work *work, int idx)
> if (node) {
> int nr;
> struct sheepdog_node_list_entry e[SD_MAX_NODES];
> + struct vm *vm, *n;
> +
> + list_for_each_entry_safe(vm, n, &sys->vm_list, list) {
> + if (memcmp(vm->ent.host_addr, node->ent.addr,
> + sizeof(node->ent.addr)) != 0)
> + continue;
> + if (vm->ent.host_port != node->ent.port)
> + continue;
> +
> + list_del(&vm->list);
> + }
>
> list_del(&node->list);
> free(node);
Oops, I forgot to free memory.
The correct version is as follows.
=
diff --git a/collie/group.c b/collie/group.c
index ec92836..47b61e8 100644
--- a/collie/group.c
+++ b/collie/group.c
@@ -1090,8 +1090,20 @@ static void __sd_confch(struct work *work, int idx)
if (node) {
int nr;
struct sheepdog_node_list_entry e[SD_MAX_NODES];
+ struct vm *vm, *n;
eprintf("(%d, %d) is in the sd_node_list\n", left_list[i].nodeid, left_list[i].pid);
+ list_for_each_entry_safe(vm, n, &sys->vm_list, list) {
+ if (memcmp(vm->ent.host_addr, node->ent.addr,
+ sizeof(node->ent.addr)) != 0)
+ continue;
+ if (vm->ent.host_port != node->ent.port)
+ continue;
+
+ list_del(&vm->list);
+ free(vm);
+ }
+
list_del(&node->list);
free(node);
More information about the sheepdog
mailing list