From: nils.carlson@ericsson.com (Nils Carlson)
Subject: [ltt-dev] [UST PATCH] libust: Fix multiple fd close during fork
Date: Wed, 23 Feb 2011 13:43:06 +0100 [thread overview]
Message-ID: <alpine.DEB.2.00.1102231340470.30437@as68123.uab.ericsson.se> (raw)
In-Reply-To: <1298464816-19832-1-git-send-email-nils.carlson@ericsson.com>
This sort of fixes things in a wider sense as with the original patch we
might leave trailing fds open and a non "auto" trace would have been
neither destroyed nor have its fds closed...
Hope its ok with you yannick. Keep up the good work!
/Nils
On Wed, 23 Feb 2011, Nils Carlson wrote:
> Remove superfluous fd closes during fork and also destroy all
> traces instead of just "auto".
>
> Reported-by: Yannick Brosseau <yannick.brosseau at gmail.com>
> Signed-off-by: Nils Carlson <nils.carlson at ericsson.com>
> ---
> libust/tracectl.c | 17 ++++++++---------
> 1 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/libust/tracectl.c b/libust/tracectl.c
> index 1bd7229..1fc0118 100644
> --- a/libust/tracectl.c
> +++ b/libust/tracectl.c
> @@ -1569,6 +1569,7 @@ static void ust_fork(void)
> {
> struct ust_buffer *buf, *buf_tmp;
> struct ustcomm_sock *sock, *sock_tmp;
> + struct ust_trace *trace, *trace_tmp;
> int result;
>
> /* FIXME: technically, the locks could have been taken before the fork */
> @@ -1589,18 +1590,16 @@ static void ust_fork(void)
> /* Delete all blocked consumers */
> cds_list_for_each_entry_safe(buf, buf_tmp, &open_buffers_list,
> open_buffers_list) {
> - result = close(buf->data_ready_fd_read);
> - if (result == -1) {
> - PERROR("close");
> - }
> - result = close(buf->data_ready_fd_write);
> - if (result == -1) {
> - PERROR("close");
> - }
> cds_list_del(&buf->open_buffers_list);
> }
>
> - ltt_trace_destroy("auto", 1);
> + /*
> + * FIXME: This could be prettier, we loop over the list twice and
> + * following good locking practice should lock around the loop
> + */
> + cds_list_for_each_entry_safe(trace, trace_tmp, <t_traces.head, list) {
> + ltt_trace_destroy(trace->trace_name, 1);
> + }
>
> /* Clean up the listener socket and epoll, keeping the scoket file */
> ustcomm_del_named_sock(listen_sock, 1);
> --
> 1.7.1
>
>
next prev parent reply other threads:[~2011-02-23 12:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-23 12:40 Nils Carlson
2011-02-23 12:43 ` Nils Carlson [this message]
2011-02-23 14:46 ` Yannick Brosseau
2011-02-23 15:54 ` Nils Carlson
2011-02-23 15:40 ` Mathieu Desnoyers
[not found] ` <BLU0-SMTP169B3ABCBCF5E7D9DB528B96DB0@phx.gbl>
2011-02-23 16:03 ` Nils Carlson
2011-02-23 15:49 ` Mathieu Desnoyers
[not found] ` <BLU0-SMTP63BB495BA90023E1C54C0E96DB0@phx.gbl>
2011-02-23 16:14 ` Nils Carlson
2011-02-23 16:16 ` Mathieu Desnoyers
[not found] ` <BLU0-SMTP763331DEBE2782CAA18D5F96DB0@phx.gbl>
2011-02-23 18:54 ` Nils Carlson
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=alpine.DEB.2.00.1102231340470.30437@as68123.uab.ericsson.se \
--to=nils.carlson@ericsson.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