Commit e142a31da34b42458e10026b554e66127739cf23

Authored by Arnd Bergmann
Committed by Greg Kroah-Hartman
1 parent b07471fa51

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
... ... @@ -1786,7 +1786,9 @@
1786 1786 tty->name, info->count);
1787 1787 /**/
1788 1788 #endif
1789   - schedule();
  1789 + tty_unlock();
  1790 + schedule();
  1791 + tty_lock();
1790 1792 }
1791 1793 __set_current_state(TASK_RUNNING);
1792 1794 remove_wait_queue(&info->open_wait, &wait);
drivers/char/specialix.c
... ... @@ -1365,7 +1365,9 @@
1365 1365 retval = -ERESTARTSYS;
1366 1366 break;
1367 1367 }
  1368 + tty_unlock();
1368 1369 schedule();
  1370 + tty_lock();
1369 1371 }
1370 1372  
1371 1373 set_current_state(TASK_RUNNING);
drivers/char/synclink.c
... ... @@ -3349,7 +3349,9 @@
3349 3349 printk("%s(%d):block_til_ready blocking on %s count=%d\n",
3350 3350 __FILE__,__LINE__, tty->driver->name, port->count );
3351 3351  
  3352 + tty_unlock();
3352 3353 schedule();
  3354 + tty_lock();
3353 3355 }
3354 3356  
3355 3357 set_current_state(TASK_RUNNING);
drivers/char/synclink_gt.c
... ... @@ -3244,7 +3244,9 @@
3244 3244 }
3245 3245  
3246 3246 DBGINFO(("%s block_til_ready wait\n", tty->driver->name));
  3247 + tty_unlock();
3247 3248 schedule();
  3249 + tty_lock();
3248 3250 }
3249 3251  
3250 3252 set_current_state(TASK_RUNNING);
drivers/char/synclinkmp.c
... ... @@ -3365,7 +3365,9 @@
3365 3365 printk("%s(%d):%s block_til_ready() count=%d\n",
3366 3366 __FILE__,__LINE__, tty->driver->name, port->count );
3367 3367  
  3368 + tty_unlock();
3368 3369 schedule();
  3370 + tty_lock();
3369 3371 }
3370 3372  
3371 3373 set_current_state(TASK_RUNNING);
drivers/char/tty_port.c
... ... @@ -294,7 +294,9 @@
294 294 retval = -ERESTARTSYS;
295 295 break;
296 296 }
  297 + tty_unlock();
297 298 schedule();
  299 + tty_lock();
298 300 }
299 301 finish_wait(&port->open_wait, &wait);
300 302  
drivers/serial/68328serial.c
... ... @@ -1235,7 +1235,9 @@
1235 1235 retval = -ERESTARTSYS;
1236 1236 break;
1237 1237 }
  1238 + tty_unlock();
1238 1239 schedule();
  1240 + tty_lock();
1239 1241 }
1240 1242 current->state = TASK_RUNNING;
1241 1243 remove_wait_queue(&info->open_wait, &wait);
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);