Commit c134dea
Al Viro
spufs: fix gang directory lifetimes
prior to "[POWERPC] spufs: Fix gang destroy leaks" we used to have
a problem with gang lifetimes - creation of a gang returns opened
gang directory, which normally gets removed when that gets closed,
but if somebody has created a context belonging to that gang and
kept it alive until the gang got closed, removal failed and we
ended up with a leak.
Unfortunately, it had been fixed the wrong way. Dentry of gang
directory was no longer pinned, and rmdir on close was gone.
One problem was that failure of open kept calling simple_rmdir()
as cleanup, which meant an unbalanced dput(). Another bug was
in the success case - gang creation incremented link count on
root directory, but that was no longer undone when gang got
destroyed.
Fix consists of
* reverting the commit in question
* adding a counter to gang, protected by ->i_rwsem
of gang directory inode.
* having it set to 1 at creation time, dropped
in both spufs_dir_close() and spufs_gang_close() and bumped
in spufs_create_context(), provided that it's not 0.
* using simple_recursive_removal() to take the gang
directory out when counter reaches zero.
Fixes: 877907d "[POWERPC] spufs: Fix gang destroy leaks"
Signed-off-by: Al Viro <[email protected]>1 parent d1ca869 commit c134dea
3 files changed
+49
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
204 | 221 | | |
205 | 222 | | |
206 | 223 | | |
| |||
215 | 232 | | |
216 | 233 | | |
217 | 234 | | |
| 235 | + | |
218 | 236 | | |
219 | 237 | | |
220 | 238 | | |
| |||
407 | 425 | | |
408 | 426 | | |
409 | 427 | | |
410 | | - | |
| 428 | + | |
411 | 429 | | |
412 | 430 | | |
413 | 431 | | |
| |||
422 | 440 | | |
423 | 441 | | |
424 | 442 | | |
425 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
426 | 449 | | |
427 | 450 | | |
428 | 451 | | |
429 | | - | |
430 | 452 | | |
431 | 453 | | |
432 | 454 | | |
| |||
455 | 477 | | |
456 | 478 | | |
457 | 479 | | |
| 480 | + | |
| 481 | + | |
458 | 482 | | |
459 | 483 | | |
460 | 484 | | |
| |||
484 | 508 | | |
485 | 509 | | |
486 | 510 | | |
| 511 | + | |
487 | 512 | | |
488 | 513 | | |
489 | 514 | | |
| |||
494 | 519 | | |
495 | 520 | | |
496 | 521 | | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
497 | 537 | | |
498 | 538 | | |
499 | 539 | | |
| |||
513 | 553 | | |
514 | 554 | | |
515 | 555 | | |
516 | | - | |
| 556 | + | |
517 | 557 | | |
518 | 558 | | |
519 | 559 | | |
| |||
528 | 568 | | |
529 | 569 | | |
530 | 570 | | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
| 571 | + | |
| 572 | + | |
535 | 573 | | |
536 | 574 | | |
537 | 575 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
0 commit comments