Commit 6732cd5
Cygwin: open: Unlock fdtab before open_with_arch()
Since the commit 31bf91f, opening fifo causes a deadlock. This
is because, open_with_arch() for fifo can be blocked until the other
side of the fifo is opened. The commit 31bf91f moves the creating
cygheap_fdnew before open_with_arch() to address the issue:
https://cygwin.com/pipermail/cygwin/2026-May/259664.html
However, cygheap_fdnew locks fdtab, so open() for the other side of
fifo cannot create cygheap_fdnew until fdtab is unlocked. This is
the cause of the deadlock.
With this patch, fdtab is unlocked before open_with_arch(), but marked
as used using tentative fhandler. The summary of open() is as follows.
1) Lock fdtab.
2) Create new fd.
3) Mark fd as used using tentative fhandler.
4) Unlock fdtab.
5) Call open_with_arch().
6) Set final fhandler to fd.
The important point is that create fd before open_with_arch() to
address https://cygwin.com/pipermail/cygwin/2026-May/259664.html,
but unlock fdtab before open_with_arch() to address
https://cygwin.com/pipermail/cygwin/2026-July/259884.html.
Fixes: 31bf91f ("Cygwin: Ensure unused fd available for open()")
Addresses: https://cygwin.com/pipermail/cygwin/2026-July/259884.html
Reported-by: kikairoya <kikairoya@gmail.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Reviewed-by: Mark Geisert <mark@maxrnd.com>
(cherry picked from commit 524d75f)1 parent 9a6cbe5 commit 6732cd5
1 file changed
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1451 | 1451 | | |
1452 | 1452 | | |
1453 | 1453 | | |
| 1454 | + | |
1454 | 1455 | | |
1455 | 1456 | | |
1456 | 1457 | | |
| |||
1550 | 1551 | | |
1551 | 1552 | | |
1552 | 1553 | | |
1553 | | - | |
| 1554 | + | |
| 1555 | + | |
1554 | 1556 | | |
1555 | | - | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
1556 | 1560 | | |
1557 | 1561 | | |
1558 | 1562 | | |
| |||
1580 | 1584 | | |
1581 | 1585 | | |
1582 | 1586 | | |
1583 | | - | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
1584 | 1592 | | |
1585 | 1593 | | |
1586 | 1594 | | |
1587 | 1595 | | |
1588 | 1596 | | |
1589 | 1597 | | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
1590 | 1604 | | |
1591 | 1605 | | |
1592 | 1606 | | |
| |||
0 commit comments