From: Hanna Reitz <hreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>
Subject: Re: [PATCH 0/3] qemu/qsd: Unlink absolute PID file path
Date: Tue, 12 Jul 2022 14:37:52 +0200 [thread overview]
Message-ID: <044695c5-c030-0cb9-9880-45e9e3ff2c29@redhat.com> (raw)
In-Reply-To: <20220609122701.17172-1-hreitz@redhat.com>
On 09.06.22 14:26, Hanna Reitz wrote:
> Hi,
>
> QEMU (the system emulator) and the storage daemon (QSD) write their PID
> to the given file when you specify --pidfile. They keep the path around
> and register exit handlers (QEMU uses an exit notifier, QSD an atexit()
> function) to unlink this file when the process terminates. These
> handlers unlink precisely the path that the user has specified via
> --pidfile, so if it was a relative path and the process has at any point
> changed its working directory, the path no longer points to the PID
> file, and so the unlink() will fail (or worse).
>
> When using --daemonize, the process will always change its working
> directory to /, so this problem basically always appears when using
> --daemonize and --pidfile in conjunction.
[...]
> We can fix the problem by running realpath() once the PID file has been
> created, so we get an absolute path that we can unlink in the exit
> handler. This is done here.
Thanks for the review, Dan, I’ve applied the series to my block branch:
https://gitlab.com/hreitz/qemu/-/commits/block
prev parent reply other threads:[~2022-07-12 12:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-09 12:26 [PATCH 0/3] qemu/qsd: Unlink absolute PID file path Hanna Reitz
2022-06-09 12:26 ` [PATCH 1/3] qsd: " Hanna Reitz
2022-07-12 12:14 ` Daniel P. Berrangé
2022-06-09 12:27 ` [PATCH 2/3] vl: Conditionally register PID file unlink notifier Hanna Reitz
2022-07-12 12:14 ` Daniel P. Berrangé
2022-06-09 12:27 ` [PATCH 3/3] vl: Unlink absolute PID file path Hanna Reitz
2022-07-12 12:19 ` Daniel P. Berrangé
2022-07-12 11:47 ` [PATCH 0/3] qemu/qsd: " Hanna Reitz
2022-07-12 12:37 ` Hanna Reitz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=044695c5-c030-0cb9-9880-45e9e3ff2c29@redhat.com \
--to=hreitz@redhat.com \
--cc=berrange@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).