lkml.org 
[lkml]   [2012]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RESEND] tty: don't dead lock while flushing workqueue
On 12/03/2012 06:41 PM, Peter Hurley wrote:
> The lock logic for tty_set_ldisc() is wrong. Despite existing code in
> tty_set_ldisc() and tty_ldisc_hangup(), the ldisc_mutex does **not**
> (and should not) play a role in acquiring or releasing ldisc references.
> The only thing that needs to happen here is below (don't actually use
> below because I just hand-edited it):

Hmm. What about I stay in sync with the code that is already in tree
and if the wrong locking gets removed in both places later on?

Alan, what do you prefer?

>> See http://lkml.org/lkml/2012/11/21/347
>>
>> drivers/tty/tty_ldisc.c | 13 +++++++++----
>> 1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
>> index 0f2a2c5..fb76818 100644
>> --- a/drivers/tty/tty_ldisc.c
>> +++ b/drivers/tty/tty_ldisc.c
>> @@ -930,16 +930,21 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
>> */
>>
>> - tty_lock_pair(tty, o_tty);
>> tty_ldisc_halt(tty);
>> tty_ldisc_flush_works(tty);
>
>
>> + tty_lock_pair(tty, o_tty);
>> /* This will need doing differently if we need to lock */
>> tty_ldisc_kill(tty);
>> -
>> if (o_tty)
>> tty_ldisc_kill(o_tty);
>>

Sebastian


\
 
 \ /
  Last update: 2012-12-05 18:22    [W:0.110 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site