Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: nils.carlson@ericsson.com (Nils Carlson)
Subject: [ltt-dev] [UST PATCH] libust: Fix multiple fd close during fork
Date: Wed, 23 Feb 2011 17:14:09 +0100	[thread overview]
Message-ID: <alpine.DEB.2.00.1102231710160.30437@as68123.uab.ericsson.se> (raw)
In-Reply-To: <BLU0-SMTP63BB495BA90023E1C54C0E96DB0@phx.gbl>



On Wed, 23 Feb 2011, Mathieu Desnoyers wrote:

> * Nils Carlson (nils.carlson at ericsson.com) wrote:
>> On Wed, 23 Feb 2011, Mathieu Desnoyers wrote:
>>
>>> * Nils Carlson (nils.carlson at ericsson.com) wrote:
>>>> Yep. fixed. merged.
>>>>
>>>>>>> +    /*
>>>>>>> +     * 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, &ltt_traces.head,
>>>>>>> list) {
>>>>>>> +        ltt_trace_destroy(trace->trace_name, 1);
>>>>>>> +    }
>>>
>>> So what' up with these missing locks ?
>>>
>>
>> They are actually taken by each ltt_trace_destroy. Also, this function is
>> run as part of the ust_fork so locking in the child is a non-issue at
>> this point. Its mostly an aesthetic thing that we should be consistent in
>> dealing with locks.
>
> Most of the ust_fork code should actually be protected by a mutex to
> deal with the fact that we might have a concurrent libust thread running
> in the parent at the exact point we do the fork, thus letting the child
> in a state where locks are taken, and waits on the locks forever,
> because the libust thread is not present in the child. The concurrent
> libust thread in the parent should be kept quiescent while we do the
> fork.
>

ust_fork is only called by the child after the fork. The function name is 
a bit misleading.

> I don't think this is handled at the moment, and can leave us with
> various of the other locks in a "held" state when we run in the child.

As far as locking is concerned we're completely safe today, as we are 
completely serialised. If we ever decide on multiple control threads or 
some such we will probably have to recheck all the locking.

/Nils


> Thoughts ?
>
> Mathieu
>
>>
>> /Nils
>>
>>> Mathieu
>>>
>>>>>>>
>>>>>>>     /* Clean up the listener socket and epoll, keeping the scoket
>>>>>>> file */
>>>>>>>     ustcomm_del_named_sock(listen_sock, 1);
>>>>>>> --
>>>>>>> 1.7.1
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> ltt-dev mailing list
>>>> ltt-dev at lists.casi.polymtl.ca
>>>> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>>>>
>>>
>>> --
>>> Mathieu Desnoyers
>>> Operating System Efficiency R&D Consultant
>>> EfficiOS Inc.
>>> http://www.efficios.com
>>>
>>
>
> -- 
> Mathieu Desnoyers
> Operating System Efficiency R&D Consultant
> EfficiOS Inc.
> http://www.efficios.com
>




  parent reply	other threads:[~2011-02-23 16:14 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
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 [this message]
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.1102231710160.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