Commit dffc7f2
committed
fs/ntfs3: allow readdir() to finish after directory mutations without rewinddir()
This patch introduces a per-directory version counter that increments on
each directory modification (indx_insert_entry() / indx_delete_entry()).
ntfs_readdir() uses this version to detect whether the directory has
changed since enumeration began. If readdir() reaches end-of-directory
but the version has changed, the walk restarts from the beginning of the
index tree instead of returning prematurely. This provides rmdir-like
behavior for tools that remove entries as they enumerate them.
Prior to this change, bonnie++ directory operations could fail due to
premature termination of readdir() during concurrent index updates.
With this patch applied, bonnie++ completes successfully with no errors.
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>1 parent 989e294 commit dffc7f2
3 files changed
Lines changed: 76 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
396 | | - | |
| 395 | + | |
397 | 396 | | |
398 | 397 | | |
399 | 398 | | |
400 | 399 | | |
401 | | - | |
402 | 400 | | |
403 | | - | |
404 | 401 | | |
405 | 402 | | |
406 | 403 | | |
407 | 404 | | |
408 | 405 | | |
409 | 406 | | |
410 | | - | |
| 407 | + | |
411 | 408 | | |
412 | 409 | | |
413 | 410 | | |
| 411 | + | |
| 412 | + | |
414 | 413 | | |
415 | 414 | | |
416 | 415 | | |
417 | 416 | | |
418 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
419 | 424 | | |
420 | | - | |
421 | | - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
422 | 466 | | |
423 | 467 | | |
424 | 468 | | |
| |||
454 | 498 | | |
455 | 499 | | |
456 | 500 | | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
457 | 504 | | |
458 | 505 | | |
459 | 506 | | |
460 | 507 | | |
461 | 508 | | |
462 | 509 | | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
475 | 515 | | |
476 | 516 | | |
477 | 517 | | |
478 | 518 | | |
479 | 519 | | |
480 | | - | |
481 | | - | |
| 520 | + | |
| 521 | + | |
482 | 522 | | |
483 | 523 | | |
484 | | - | |
485 | | - | |
| 524 | + | |
| 525 | + | |
486 | 526 | | |
487 | 527 | | |
488 | 528 | | |
| |||
492 | 532 | | |
493 | 533 | | |
494 | 534 | | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
495 | 538 | | |
496 | | - | |
| 539 | + | |
| 540 | + | |
497 | 541 | | |
498 | 542 | | |
499 | | - | |
500 | | - | |
501 | 543 | | |
502 | 544 | | |
503 | 545 | | |
504 | | - | |
505 | 546 | | |
506 | 547 | | |
507 | 548 | | |
508 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
509 | 553 | | |
510 | 554 | | |
511 | 555 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2002 | 2002 | | |
2003 | 2003 | | |
2004 | 2004 | | |
| 2005 | + | |
2005 | 2006 | | |
2006 | 2007 | | |
2007 | 2008 | | |
| |||
2649 | 2650 | | |
2650 | 2651 | | |
2651 | 2652 | | |
| 2653 | + | |
2652 | 2654 | | |
2653 | 2655 | | |
2654 | 2656 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| |||
0 commit comments