Commit 64a8b17
committed
nsenter: use TryLock in reaper to prevent cascading FUSE deadlock
Replace mu.Lock() with mu.TryLock() in the zombie reaper goroutine. Go's
sync.RWMutex implements writer-preference: a pending Lock() blocks all
subsequent RLock() callers. When the reaper's Lock() is pending while an
nsenter child holds RLock, all new FUSE Lookup handlers are blocked from
acquiring RLock to start their own nsenter processes. If the nsenter child's
operation triggers a FUSE request back to sysbox-fs, the FUSE handler cannot
proceed, creating a deadlock.
TryLock() does not register a pending writer, so FUSE handlers can still
acquire RLock. If TryLock fails, the reaper sleep a second to retry.
Fixes: nestybox/sysbox#10021 parent b70bd38 commit 64a8b17
1 file changed
Lines changed: 11 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
77 | 76 | | |
78 | | - | |
79 | | - | |
80 | 77 | | |
81 | 78 | | |
82 | 79 | | |
83 | 80 | | |
84 | | - | |
85 | 81 | | |
86 | 82 | | |
87 | 83 | | |
88 | 84 | | |
89 | | - | |
90 | 85 | | |
| 86 | + | |
91 | 87 | | |
92 | 88 | | |
0 commit comments