Commit e142a31da34b42458e10026b554e66127739cf23
Committed by
Greg Kroah-Hartman
1 parent
b07471fa51
Exists in
master
and in
39 other branches
tty: release BTM while sleeping in block_til_ready
Most tty drivers may block while opening a device. Since this possibly depends on another thread closing it first and both threads may need the BTM, we need to release it here. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 11 changed files with 25 additions and 1 deletions Side-by-side Diff
drivers/char/amiserial.c
... | ... | @@ -1710,7 +1710,9 @@ |
1710 | 1710 | printk("block_til_ready blocking: ttys%d, count = %d\n", |
1711 | 1711 | info->line, state->count); |
1712 | 1712 | #endif |
1713 | + tty_unlock(); | |
1713 | 1714 | schedule(); |
1715 | + tty_lock(); | |
1714 | 1716 | } |
1715 | 1717 | __set_current_state(TASK_RUNNING); |
1716 | 1718 | remove_wait_queue(&info->open_wait, &wait); |
drivers/char/ip2/ip2main.c
... | ... | @@ -1486,7 +1486,9 @@ |
1486 | 1486 | |
1487 | 1487 | if ( tty_hung_up_p(pFile) || ( pCh->flags & ASYNC_CLOSING )) { |
1488 | 1488 | if ( pCh->flags & ASYNC_CLOSING ) { |
1489 | + tty_unlock(); | |
1489 | 1490 | schedule(); |
1491 | + tty_lock(); | |
1490 | 1492 | } |
1491 | 1493 | if ( tty_hung_up_p(pFile) ) { |
1492 | 1494 | set_current_state( TASK_RUNNING ); |
1493 | 1495 | |
... | ... | @@ -1548,7 +1550,9 @@ |
1548 | 1550 | rc = (( pCh->flags & ASYNC_HUP_NOTIFY ) ? -EAGAIN : -ERESTARTSYS); |
1549 | 1551 | break; |
1550 | 1552 | } |
1553 | + tty_unlock(); | |
1551 | 1554 | schedule(); |
1555 | + tty_lock(); | |
1552 | 1556 | } |
1553 | 1557 | set_current_state( TASK_RUNNING ); |
1554 | 1558 | remove_wait_queue(&pCh->open_wait, &wait); |
drivers/char/serial167.c
drivers/char/specialix.c
drivers/char/synclink.c
drivers/char/synclink_gt.c
drivers/char/synclinkmp.c
drivers/char/tty_port.c
drivers/serial/68328serial.c
drivers/serial/68360serial.c
... | ... | @@ -1860,7 +1860,9 @@ |
1860 | 1860 | printk("block_til_ready blocking: ttys%d, count = %d\n", |
1861 | 1861 | info->line, state->count); |
1862 | 1862 | #endif |
1863 | + tty_unlock(); | |
1863 | 1864 | schedule(); |
1865 | + tty_lock(); | |
1864 | 1866 | } |
1865 | 1867 | current->state = TASK_RUNNING; |
1866 | 1868 | remove_wait_queue(&info->open_wait, &wait); |
drivers/serial/crisv10.c
... | ... | @@ -4066,7 +4066,9 @@ |
4066 | 4066 | printk("block_til_ready blocking: ttyS%d, count = %d\n", |
4067 | 4067 | info->line, info->count); |
4068 | 4068 | #endif |
4069 | + tty_unlock(); | |
4069 | 4070 | schedule(); |
4071 | + tty_lock(); | |
4070 | 4072 | } |
4071 | 4073 | set_current_state(TASK_RUNNING); |
4072 | 4074 | remove_wait_queue(&info->open_wait, &wait); |