[lxc-devel] [PATCH 3/2] nbd: exit cleanly if nbd fails to attach
Dwight Engen
dwight.engen at oracle.com
Fri May 16 13:50:44 UTC 2014
On Thu, 15 May 2014 15:26:48 +0000
Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Acked-by: Dwight Engen <dwight.engen at oracle.com>
> ---
> src/lxc/bdev.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
> index e22d83d..1d9a25a 100644
> --- a/src/lxc/bdev.c
> +++ b/src/lxc/bdev.c
> @@ -2491,7 +2491,15 @@ static int do_attach_nbd(void *d)
> exit(0);
> } else if (fdsi.ssi_signo == SIGCHLD) {
> int status;
> - while (waitpid(-1, &status, WNOHANG)
> > 0);
> + /* If qemu-nbd fails, or is killed
> by a signal,
> + * then exit */
> + while (waitpid(-1, &status, WNOHANG)
> > 0) {
> + if ((WIFEXITED(status) &&
> WEXITSTATUS(status) != 0) ||
> +
> WIFSIGNALED(status)) {
> + nbd_detach(nbd);
> + exit(1);
> + }
> + }
> }
> }
> }
More information about the lxc-devel
mailing list