From: "Daniel P. Berrangé" <berrange@redhat.com>
To: AlexChen <alex.chen@huawei.com>
Cc: zhengchuan@huawei.com, pbonzini@redhat.com,
qemu-devel@nongnu.org, zhang.zhanghailiang@huawei.com
Subject: Re: oslib-posix:Fix handle fd leak in qemu_write_pidfile()
Date: Wed, 26 Aug 2020 11:18:35 +0100 [thread overview]
Message-ID: <20200826101835.GM168515@redhat.com> (raw)
In-Reply-To: <5F463618.10000@huawei.com>
On Wed, Aug 26, 2020 at 06:14:48PM +0800, AlexChen wrote:
> From: alexchen <alex.chen@huawei.com>
>
> The fd will leak when (a.st_ino == b.st_ino) is true, fix it.
That is *INTENTIONAL*. We're holding a lock on the file and the
lock exists only while the FD is open. When QEMU exists, the FD
is closed and the lock is released. There is no leak.
> Signed-off-by: AlexChen <alex.chen@huawei.com>
> ---
> util/oslib-posix.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index ad8001a4ad..74cf5e9c73 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -176,6 +176,7 @@ bool qemu_write_pidfile(const char *path, Error **errp)
> goto fail_unlink;
> }
>
> + close(fd);
> return true;
>
> fail_unlink:
> --
> 2.19.1
>
>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2020-08-26 10:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 10:14 oslib-posix:Fix handle fd leak in qemu_write_pidfile() AlexChen
2020-08-26 10:18 ` Daniel P. Berrangé [this message]
2020-08-27 2:40 ` AlexChen
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=20200826101835.GM168515@redhat.com \
--to=berrange@redhat.com \
--cc=alex.chen@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhang.zhanghailiang@huawei.com \
--cc=zhengchuan@huawei.com \
/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).