Repository navigation
Commit 7959609
committed
hlink: re-root a hard-link group whose root is in a released file list
Address the review comment on this patch (#1144):
"This will still abort when the hard-link group spans incremental
file-list chunks. Re-root the group without retaining released
file-list indices."
When a group spans chunks, a member's F_HL_PREV can point into a
file-list that is released before the member's finish_hard_link()
walks the completion chain, and the fatal flist_for_ndx() call
aborts the transfer. Two changes in finish_hard_link():
1. The completion-chain lookup now uses the graceful (NULL) variant
of flist_for_ndx() and stops the walk when an index is no longer
in a live file-list. The chain only moves to earlier ndx values,
so once one is released, everything further back is already
finished and there is nothing left to re-link. No live file
retains a released index: the finishing file's F_HL_PREV is reset
on entry, and each walked member's F_HL_PREV is pointed at the
finishing file.
2. A duplicate finish (the group already recorded as finished at
some path) now re-roots the group at the newly finished file
instead of keeping the recorded path. A duplicate finish only
happens when the recorded root could not be hard-linked (e.g.
EMLINK, EXDEV) and that member was written as a regular file, so
that member's inode is the only one the group can still link to;
later members then link to this live file instead of the stale
root.
The abort path is timing dependent (as noted in the review) and not
reproducible in the local single-process test setup, where the
leader's status is always consumed before the generator matches a
deeper file-list. Test evidence (PR description): a 1200-file
chunk-spanning EMLINK fixture with the destination inode pinned at
the ext4 65000-link cap completes in 0.2 s with rc 23 and the group
re-rooted on a fresh inode; the single-flist EMLINK fixture takes
0.15 s, rc 23, all 101 members on one fresh inode; the hard-link
regression tree is all rc 0 with no spurious output; the upstream
hardlink/link-dest/keep-dirlinks suite (9 tests) passes.1 parent 350425a commit 7959609
1 file changed
Lines changed: 19 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
532 | 540 | | |
533 | 541 | | |
534 | 542 | | |
| |||
559 | 567 | | |
560 | 568 | | |
561 | 569 | | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
568 | 578 | | |
569 | | - | |
570 | | - | |
571 | | - | |
| 579 | + | |
| 580 | + | |
572 | 581 | | |
573 | 582 | | |
574 | 583 | | |
| |||
0 commit comments