Commit 5d85724
vfs: clear temporary notReady lists
`EpollInstance.Readiness()` and `EpollInstance.ReadEvents()` queue not-ready
`epollInterest`s on temporary lists named `notReady`, so that they can be
rechecked (with `EpollInstance.readyMu` locked) for concurrent
`epollInterest.NotifyEvents()` before returning. When `epollInterest`s have
*not* been concurrently notified, they are left on the `notReady` list, which
is discarded when the containing function returns.
However, since `notReady` is an intrusive linked list, this means that
not-ready `epollInterest`s can retain pointers to other not-ready
`epollInterest`s in `epollInterest.epollInterestEntry.Prev/Next`. If a
not-ready `epollInterest` is deleted (because e.g. its corresponding
`FileDescription` reaches zero references), but another live `epollInterest`
has a pointer to the deleted `epollInterest`, then the deleted `epollInterest`
will be preserved by save/restore; after restore, `epollInterest.afterLoad()`
will cause the deleted `epollInterest` to be marked ready again, causing it to
be incorrectly polled by the first post-restore call to
`EpollInstance.Readiness()` or `EpollInstance.ReadEvents()` on the affected
`EpollInstance`.
Fix this by unconditionally removing `epollInterest`s from `notReady` lists. As
an additional defensive measure, skip `epollInterest.afterLoad()` for deleted
`epollInterest`s.
PiperOrigin-RevId: 8926212711 parent a65eb6a commit 5d85724
2 files changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| 141 | + | |
| 142 | + | |
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
143 | | - | |
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
| |||
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
| 182 | + | |
180 | 183 | | |
181 | 184 | | |
182 | | - | |
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
| |||
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
| 407 | + | |
405 | 408 | | |
406 | 409 | | |
407 | 410 | | |
| |||
443 | 446 | | |
444 | 447 | | |
445 | 448 | | |
| 449 | + | |
446 | 450 | | |
447 | 451 | | |
448 | | - | |
449 | 452 | | |
450 | 453 | | |
451 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
189 | 191 | | |
0 commit comments