[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH 2/4] os-posix: report error message when lock
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-trivial] [PATCH 2/4] os-posix: report error message when lock file failed |
Date: |
Fri, 24 Oct 2014 11:32:15 +0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.8.1 |
On 09/25/2014 01:46 PM, address@hidden wrote:
> From: Gonglei <address@hidden>
>
> It will cause that create vm failed When manager
> tool is killed forcibly (kill -9 libvirtd_pid),
> the file not was unlink, and unlock. It's better
> that report the error message for users.
>
> Signed-off-by: Huangweidong <address@hidden>
> Signed-off-by: Gonglei <address@hidden>
> ---
> os-posix.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/os-posix.c b/os-posix.c
> index 9d5ae70..89831dc 100644
> --- a/os-posix.c
> +++ b/os-posix.c
> @@ -316,6 +316,7 @@ int qemu_create_pidfile(const char *filename)
> return -1;
> }
> if (lockf(fd, F_TLOCK, 0) == -1) {
> + error_report("lock file '%s' failed: %s", filename, strerror(errno));
> close(fd);
> return -1;
> }
I think I'll just revert this patch, because indeed, it makes
no sense to do this like that.
Context:
qemu_create_pidfile() is only created from main(), and there,
if that function returns failure, os_pidfile_error() function
is called, to, guess that, report error (which is done differently
whenever we're daemonizing or not).
qemu_create_pidfile() function has several error returns, this
lockf() failure is one of them, there are others (another shown
in the patch context too).
So this patch makes whole thing inconsistent at least.
If we need to show error message when we're daemonizing, it
looks like we should modify os_pidfile_error() routine to always
report error and only after that check for daemon mode. This way
all errors will be reported the same way.
But I really wonder if we actually need os_pidfile_error() in the
first place, why this can't be done in qemu_create_pidfile().
So, I'm reverting this change now, to be revisited very soon.
Thanks,
/mjt
- Re: [Qemu-trivial] [PATCH 2/4] os-posix: report error message when lock file failed,
Michael Tokarev <=