Quoting Christian Brauner (christianvanbrau...@gmail.com):
> Signed-off-by: Christian Brauner <christianvanbrau...@gmail.com>
> 
>  100.0% src/lxc/
> diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
> index ada3958..475d878 100644
> --- a/src/lxc/bdev.c
> +++ b/src/lxc/bdev.c
> @@ -3614,3 +3614,21 @@ bool rootfs_is_blockdev(struct lxc_conf *conf)
>               return true;
>       return false;
>  }
> +
> +bool bdev_destroy(struct lxc_conf *conf)
> +{
> +     struct bdev *r;
> +     bool ret = false;
> +
> +     r = bdev_init(conf, conf->rootfs.path, conf->rootfs.mount, NULL);
> +     if (!r)
> +             return ret;
> +
> +     if (r->ops->destroy(r) < 0)

You need to bdev_put here.

> +             return ret;
> +     bdev_put(r);
> +
> +     ret = true;
> +     return ret;
> +}
> +
> diff --git a/src/lxc/bdev.h b/src/lxc/bdev.h
> index 428b3b7..b034bcb 100644
> --- a/src/lxc/bdev.h
> +++ b/src/lxc/bdev.h
> @@ -123,6 +123,7 @@ struct bdev *bdev_copy(struct lxc_container *c0, const 
> char *cname,
>  struct bdev *bdev_create(const char *dest, const char *type,
>                       const char *cname, struct bdev_specs *specs);
>  void bdev_put(struct bdev *bdev);
> +bool bdev_destroy(struct lxc_conf *conf);
>  
>  /*
>   * these are really for qemu-nbd support, as container shutdown
> -- 
> 2.5.1
> 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to