diff --git a/internal/dir/dir.go b/internal/dir/dir.go index 6913e1e1..8e8b88a2 100644 --- a/internal/dir/dir.go +++ b/internal/dir/dir.go @@ -180,6 +180,9 @@ func (m *Manager) lookupUnlocked(ctx context.Context, dirIno *inode.Inode, name // Add adds a new entry to a directory. // Uses an optimistic retry pattern to handle concurrent modifications from other nodes. func (m *Manager) Add(ctx context.Context, dirIno *inode.Inode, name string, childInode uint64, fileType uint8) error { + if dirIno.Magic != inode.InodeMagic { + return ErrRemoved + } if !dirIno.IsDir() { return ErrNotDirectory } @@ -318,6 +321,9 @@ func (m *Manager) Remove(ctx context.Context, dirIno *inode.Inode, name string) // RemoveIf removes name if ok accepts the inode it names; ok runs under the directory lock. func (m *Manager) RemoveIf(ctx context.Context, dirIno *inode.Inode, name string, ok func(child uint64) bool) (bool, error) { + if dirIno.Magic != inode.InodeMagic { + return false, ErrRemoved + } if !dirIno.IsDir() { return false, ErrNotDirectory } diff --git a/internal/goclusterfs/fs.go b/internal/goclusterfs/fs.go index 2166f0ca..b8acc120 100644 --- a/internal/goclusterfs/fs.go +++ b/internal/goclusterfs/fs.go @@ -785,8 +785,8 @@ func (f *FS) freeSlotGeneration(num uint32) uint64 { // afterCommit runs between an operation's journal commit and its first change; tests stop there as a crash would. var afterCommit func(op string) -// retryClaim runs try again, after a jittered backoff, while another node takes the inode slot it picked first. -func retryClaim(op, name string, try func() syscall.Errno) syscall.Errno { +// retryRace runs try again, after a jittered backoff, while it returns EAGAIN for losing a race with another node. +func retryRace(op, name string, try func() syscall.Errno) syscall.Errno { for attempt := 0; attempt < MaxCreateRetries; attempt++ { errno := try() if errno != syscall.EAGAIN { @@ -794,13 +794,24 @@ func retryClaim(op, name string, try func() syscall.Errno) syscall.Errno { } baseDelay := time.Millisecond * time.Duration(1<= t.totalInodes { + return nil, ErrInodeOutOfRange + } + if t.lockMgr != nil { + if err := t.lockMgr.Acquire(ctx, lock.LockTypeInode, uint64(num), lock.LockModeExclusive); err != nil { + return nil, fmt.Errorf("failed to acquire inode lock: %w", err) + } + defer t.unlock(lock.LockTypeInode, uint64(num)) + } + unlockSector, err := t.lockSector(num) + if err != nil { + return nil, err + } + defer unlockSector() + + t.mu.Lock() + defer t.mu.Unlock() + + ino, err := t.readInodeUnlocked(num) + if err != nil { + return nil, err + } + if err := change(ino); err != nil { + return nil, err + } + return t.writeWithTree(ino) +} + // WriteWithLockHeld writes an inode to disk without acquiring the distributed lock. // Use this when the caller already holds the inode lock (e.g., in directory operations). // This prevents deadlock from trying to acquire the same lock twice. diff --git a/internal/journal/cross_node_recovery.go b/internal/journal/cross_node_recovery.go index 75d5f3db..19345a4d 100644 --- a/internal/journal/cross_node_recovery.go +++ b/internal/journal/cross_node_recovery.go @@ -127,7 +127,7 @@ type txnApplyResult struct { // applyTransaction applies a single recovered transaction idempotently. func applyTransaction(ctx context.Context, rctx *RecoveryContext, txn *RecoveredTxn) (*txnApplyResult, error) { result := &txnApplyResult{} - r := newTxnReplay() + r := newTxnReplay(txn.Header.OwnerNodeUUID) for _, entry := range txn.Entries { applied, err := applyEntry(ctx, rctx, r, entry) @@ -148,12 +148,13 @@ func applyTransaction(ctx context.Context, rctx *RecoveryContext, txn *Recovered // node's. A peer can take a dead node's locks before its journal is replayed, so each record checks that what it // changes is still as the operation left it. type txnReplay struct { + owner [16]byte created map[uint64]bool wrote map[uint32]uint64 } -func newTxnReplay() *txnReplay { - return &txnReplay{created: make(map[uint64]bool), wrote: make(map[uint32]uint64)} +func newTxnReplay(owner [16]byte) *txnReplay { + return &txnReplay{owner: owner, created: make(map[uint64]bool), wrote: make(map[uint32]uint64)} } // unchanged reports whether ino is in use and was last written before a record logged its MetaGeneration as gen, or @@ -195,7 +196,8 @@ func applyEntry(ctx context.Context, rctx *RecoveryContext, r *txnReplay, entry } } -// applyInodeCreate claims the inode's slot if it is still free and nobody used it since the create was logged. +// applyInodeCreate claims the inode's slot if it is still free and nobody used it since the create was logged, or +// takes over the create's own claim if it landed before the crash. func applyInodeCreate(ctx context.Context, rctx *RecoveryContext, r *txnReplay, payload []byte) (bool, error) { p, err := DeserializeInodeCreate(payload) if err != nil { @@ -206,13 +208,49 @@ func applyInodeCreate(ctx context.Context, rctx *RecoveryContext, r *txnReplay, return free.MetaGeneration == p.MetaGeneration }) if errors.Is(err, inode.ErrInodeInUse) { - log.Printf("[Recovery] InodeCreate: slot %d is in use or was used since, skipping", p.InodeNum) - return false, nil + ino, err = r.ownClaim(rctx, p) + if ino == nil && err == nil { + log.Printf("[Recovery] InodeCreate: slot %d is in use or was used since, skipping", p.InodeNum) + return false, nil + } } if err != nil { return false, fmt.Errorf("failed to claim inode %d: %w", p.InodeNum, err) } + if ino.Mode == 0 { + if err := initCreated(ctx, rctx, ino, p); err != nil { + return false, fmt.Errorf("failed to set up inode %d: %w", p.InodeNum, err) + } + } + r.created[p.InodeNum] = true + r.wrote[ino.InodeNum] = ino.MetaGeneration + + log.Printf("[Recovery] InodeCreate: created inode %d", p.InodeNum) + return true, nil +} + +// ownClaim returns the slot's inode if the create's own claim landed and nothing wrote the inode since: the logging +// node wrote it last, and at most as often as a create does before adding the name. +func (r *txnReplay) ownClaim(rctx *RecoveryContext, p *InodeCreatePayload) (*inode.Inode, error) { + ino, err := rctx.InodeTbl.Read(uint32(p.InodeNum)) + if err != nil { + return nil, err + } + writes := ino.MetaGeneration - p.MetaGeneration + maxWrites := uint64(2) // the claim, then the attributes + if uint16(p.Mode)&inode.S_IFMT == inode.S_IFDIR { + maxWrites = 3 // the claim, "." and "..", then the attributes + } + if ino.Magic != inode.InodeMagic || ino.LastModifierUUID != r.owner || writes < 1 || writes > maxWrites || + ino.Mode != 0 && ino.Mode != uint16(p.Mode) { + return nil, nil + } + return ino, nil +} + +// initCreated gives a newly claimed inode the logged attributes, and a directory its "." and ".." entries. +func initCreated(ctx context.Context, rctx *RecoveryContext, ino *inode.Inode, p *InodeCreatePayload) error { ino.Mode = uint16(p.Mode) ino.UID = p.UID ino.GID = p.GID @@ -220,14 +258,11 @@ func applyInodeCreate(ctx context.Context, rctx *RecoveryContext, r *txnReplay, ino.Atime = now ino.Mtime = now ino.Ctime = now - if err := rctx.InodeTbl.Write(ctx, ino); err != nil { - return false, fmt.Errorf("failed to write inode %d: %w", p.InodeNum, err) + if !ino.IsDir() { + return rctx.InodeTbl.Write(ctx, ino) } - r.created[p.InodeNum] = true - r.wrote[ino.InodeNum] = ino.MetaGeneration - - log.Printf("[Recovery] InodeCreate: created inode %d", p.InodeNum) - return true, nil + ino.LinkCount = 2 + return rctx.DirMgr.InitDirectory(ctx, ino, p.ParentInodeNum) } // applyInodeUpdate updates an inode's metadata. @@ -316,6 +351,14 @@ func applyDirAddEntry(ctx context.Context, rctx *RecoveryContext, r *txnReplay, case err != nil: return false, fmt.Errorf("failed to add entry %q: %w", p.Name, err) } + if p.EntryType == DirEntryDirectory { + if err := rctx.InodeTbl.Update(ctx, uint32(p.ParentInodeNum), func(parent *inode.Inode) error { + parent.LinkCount++ + return nil + }); err != nil { + return true, fmt.Errorf("failed to count the link from %q in parent %d: %w", p.Name, p.ParentInodeNum, err) + } + } log.Printf("[Recovery] DirAddEntry: added entry %q -> inode %d in parent %d", p.Name, p.ChildInodeNum, p.ParentInodeNum) diff --git a/internal/journal/cross_node_recovery_test.go b/internal/journal/cross_node_recovery_test.go index d0e5e187..95d029b8 100644 --- a/internal/journal/cross_node_recovery_test.go +++ b/internal/journal/cross_node_recovery_test.go @@ -50,7 +50,7 @@ func testRecoveryContext(t testing.TB) (*RecoveryContext, func()) { t.Skipf("O_DIRECT not supported: %v", err) } - nodeUUID := [16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} + nodeUUID := testNodeUUID bm := bitmap.NewRegion(dev, bitmapOffset, totalBlocks, nil, nodeUUID) inodeTbl := inode.NewTable(dev, inodeOffset, inodeCount*inode.InodeSize, nil, nodeUUID) @@ -79,7 +79,7 @@ func TestApplyInodeCreate(t *testing.T) { rctx, cleanup := testRecoveryContext(t) defer cleanup() ctx := context.Background() - r := newTxnReplay() + r := newTxnReplay([16]byte{}) // Create a payload for inode creation // Note: Use inode number < 100 since test context only creates 100 inodes @@ -132,7 +132,7 @@ func TestApplyInodeUpdate(t *testing.T) { rctx, cleanup := testRecoveryContext(t) defer cleanup() ctx := context.Background() - r := newTxnReplay() + r := newTxnReplay([16]byte{}) // First, create an inode to update // Note: Use inode number < 100 since test context only creates 100 inodes @@ -168,7 +168,7 @@ func TestApplyInodeDelete(t *testing.T) { rctx, cleanup := testRecoveryContext(t) defer cleanup() ctx := context.Background() - r := newTxnReplay() + r := newTxnReplay([16]byte{}) // First, create an inode to delete // Note: Use inode number < 100 since test context only creates 100 inodes @@ -280,34 +280,9 @@ func TestApplyDirAddEntry(t *testing.T) { rctx, cleanup := testRecoveryContext(t) defer cleanup() ctx := context.Background() - r := newTxnReplay() + r := newTxnReplay([16]byte{}) - // Create a parent directory inode - parentPayload := &InodeCreatePayload{ - InodeNum: uint64(inode.InodeRoot), - Mode: uint32(inode.S_IFDIR | 0755), - UID: 0, - GID: 0, - } - if _, err := applyInodeCreate(ctx, rctx, r, parentPayload.Serialize()); err != nil { - t.Fatalf("Setup: failed to create parent inode: %v", err) - } - - // Update link count for parent - parentIno, err := rctx.InodeTbl.Read(inode.InodeRoot) - if err != nil { - t.Fatalf("Setup: failed to read parent inode: %v", err) - } - parentIno.LinkCount = 2 - if err := rctx.InodeTbl.Write(ctx, parentIno); err != nil { - t.Fatalf("Setup: failed to write parent inode: %v", err) - } - - // Initialize the directory structure - parentIno, _ = rctx.InodeTbl.Read(inode.InodeRoot) - if err := rctx.DirMgr.InitDirectory(ctx, parentIno, uint64(inode.InodeRoot)); err != nil { - t.Fatalf("Setup: failed to init directory: %v", err) - } + newRootDir(t, rctx) // Create a child inode childPayload := &InodeCreatePayload{ @@ -337,7 +312,7 @@ func TestApplyDirAddEntry(t *testing.T) { } // Verify the entry was added - parentIno, _ = rctx.InodeTbl.Read(inode.InodeRoot) + parentIno, _ := rctx.InodeTbl.Read(inode.InodeRoot) childNum, _, err := rctx.DirMgr.Lookup(ctx, parentIno, "testfile.txt") if err != nil { t.Fatalf("Failed to lookup added entry: %v", err) @@ -361,25 +336,9 @@ func TestApplyDirRemoveEntry(t *testing.T) { rctx, cleanup := testRecoveryContext(t) defer cleanup() ctx := context.Background() - r := newTxnReplay() + r := newTxnReplay([16]byte{}) - // Setup: Create parent dir, child inode, and add entry - parentPayload := &InodeCreatePayload{ - InodeNum: uint64(inode.InodeRoot), - Mode: uint32(inode.S_IFDIR | 0755), - } - if _, err := applyInodeCreate(ctx, rctx, r, parentPayload.Serialize()); err != nil { - t.Fatalf("Setup: failed to create parent inode: %v", err) - } - parentIno, _ := rctx.InodeTbl.Read(inode.InodeRoot) - parentIno.LinkCount = 2 - if err := rctx.InodeTbl.Write(ctx, parentIno); err != nil { - t.Fatal(err) - } - parentIno, _ = rctx.InodeTbl.Read(inode.InodeRoot) - if err := rctx.DirMgr.InitDirectory(ctx, parentIno, uint64(inode.InodeRoot)); err != nil { - t.Fatalf("Setup: failed to init directory: %v", err) - } + newRootDir(t, rctx) childPayload := &InodeCreatePayload{InodeNum: 20, Mode: 0644} if _, err := applyInodeCreate(ctx, rctx, r, childPayload.Serialize()); err != nil { @@ -417,7 +376,7 @@ func TestApplyDirRemoveEntry(t *testing.T) { } // Verify the entry was removed - parentIno, _ = rctx.InodeTbl.Read(inode.InodeRoot) + parentIno, _ := rctx.InodeTbl.Read(inode.InodeRoot) _, _, err = rctx.DirMgr.Lookup(ctx, parentIno, "toremove.txt") if err != dir.ErrNotFound { t.Errorf("Entry should be removed, but Lookup returned err=%v", err) @@ -438,7 +397,7 @@ func TestApplyExtentAdd(t *testing.T) { rctx, cleanup := testRecoveryContext(t) defer cleanup() ctx := context.Background() - r := newTxnReplay() + r := newTxnReplay([16]byte{}) // Create an inode to attach the extent to inodePayload := &InodeCreatePayload{ @@ -496,7 +455,7 @@ func TestApplyExtentAdd(t *testing.T) { } // A second replay finds the inode written since the write was logged. - applied, err = applyExtentAdd(ctx, rctx, newTxnReplay(), extentPayload.Serialize()) + applied, err = applyExtentAdd(ctx, rctx, newTxnReplay([16]byte{}), extentPayload.Serialize()) if err != nil { t.Fatalf("applyExtentAdd (idempotent) failed: %v", err) } @@ -512,7 +471,7 @@ func TestApplyExtentAddIntoTree(t *testing.T) { rctx, cleanup := testRecoveryContext(t) defer cleanup() ctx := context.Background() - r := newTxnReplay() + r := newTxnReplay([16]byte{}) if _, err := applyInodeCreate(ctx, rctx, r, (&InodeCreatePayload{InodeNum: 51, Mode: 0644}).Serialize()); err != nil { t.Fatalf("Setup: failed to create inode: %v", err) @@ -540,7 +499,7 @@ func TestApplyExtentAddIntoTree(t *testing.T) { } payload := (&ExtentAddPayload{InodeNum: 51, FileBlock: 6, DiskBlock: lost, Length: 1, MetaGeneration: ino.MetaGeneration}).Serialize() for attempt, wantApplied := range []bool{true, false} { - applied, err := applyExtentAdd(ctx, rctx, newTxnReplay(), payload) + applied, err := applyExtentAdd(ctx, rctx, newTxnReplay([16]byte{}), payload) if err != nil { t.Fatalf("replay %d: %v", attempt, err) } @@ -650,14 +609,14 @@ func TestApplyExtentFreeCutsUnchangedInode(t *testing.T) { ino := newDataInode(t, rctx, 50, 1, 2, 3) stale := &ExtentFreePayload{InodeNum: 50, MetaGeneration: ino.MetaGeneration - 1, Size: 1 << 20} - if applied, err := applyExtentFree(ctx, rctx, newTxnReplay(), stale.Serialize()); err != nil || applied { + if applied, err := applyExtentFree(ctx, rctx, newTxnReplay([16]byte{}), stale.Serialize()); err != nil || applied { t.Fatalf("applyExtentFree logged before a later inode write = %v, %v; want false, nil", applied, err) } free := (&ExtentFreePayload{InodeNum: 50, MetaGeneration: ino.MetaGeneration, Size: 1 << 20}).Serialize() - if applied, err := applyExtentFree(ctx, rctx, newTxnReplay(), free); err != nil || !applied { + if applied, err := applyExtentFree(ctx, rctx, newTxnReplay([16]byte{}), free); err != nil || !applied { t.Fatalf("applyExtentFree = %v, %v; want true, nil", applied, err) } - if applied, err := applyExtentFree(ctx, rctx, newTxnReplay(), free); err != nil || applied { + if applied, err := applyExtentFree(ctx, rctx, newTxnReplay([16]byte{}), free); err != nil || applied { t.Fatalf("second applyExtentFree = %v, %v; want false, nil", applied, err) } @@ -719,7 +678,7 @@ func TestPayloadsWithoutGenerations(t *testing.T) { func recoveredTxn(records ...interface { Serialize() []byte }) *RecoveredTxn { - txn := &RecoveredTxn{} + txn := &RecoveredTxn{Header: &TxnHeader{}} for _, rec := range records { var op TxnOpType switch rec.(type) { @@ -745,14 +704,8 @@ func recoveredTxn(records ...interface { func newRootDir(t *testing.T, rctx *RecoveryContext) { t.Helper() ctx := context.Background() - if _, err := applyInodeCreate(ctx, rctx, newTxnReplay(), (&InodeCreatePayload{InodeNum: uint64(inode.InodeRoot), Mode: uint32(inode.S_IFDIR | 0755)}).Serialize()); err != nil { - t.Fatal(err) - } - root, err := rctx.InodeTbl.Read(inode.InodeRoot) - if err != nil { - t.Fatal(err) - } - if err := rctx.DirMgr.InitDirectory(ctx, root, uint64(inode.InodeRoot)); err != nil { + root := &InodeCreatePayload{InodeNum: uint64(inode.InodeRoot), Mode: uint32(inode.S_IFDIR | 0755), ParentInodeNum: uint64(inode.InodeRoot)} + if _, err := applyInodeCreate(ctx, rctx, newTxnReplay([16]byte{}), root.Serialize()); err != nil { t.Fatal(err) } } @@ -934,6 +887,64 @@ func TestReplayedCreateSkipsUsedSlot(t *testing.T) { } } +var testNodeUUID = [16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} + +// A create's claim lands before the crash: replay adds the name if the logging node wrote the inode last, and no more +// often than a create does before naming it. Nothing else can reach an unnamed inode. +func TestReplayedCreateFinishesOwnClaim(t *testing.T) { + for _, tc := range []struct { + name string + owner [16]byte + writes int + named bool + }{ + {"claimed", testNodeUUID, 0, true}, + {"claimed and set up", testNodeUUID, 1, true}, + {"claimed by another node", [16]byte{}, 0, false}, + {"written since", testNodeUUID, 2, false}, + } { + t.Run(tc.name, func(t *testing.T) { + rctx, cleanup := testRecoveryContext(t) + defer cleanup() + ctx := context.Background() + newRootDir(t, rctx) + free, err := rctx.InodeTbl.Read(50) + if err != nil { + t.Fatal(err) + } + ino, err := rctx.InodeTbl.ClaimSlot(ctx, 50) + if err != nil { + t.Fatal(err) + } + for range tc.writes { + ino.Mode = inode.S_IFREG | 0644 + if err := rctx.InodeTbl.Write(ctx, ino); err != nil { + t.Fatal(err) + } + } + + create := recoveredTxn( + &InodeCreatePayload{InodeNum: 50, Mode: uint32(inode.S_IFREG | 0644), ParentInodeNum: uint64(inode.InodeRoot), MetaGeneration: free.MetaGeneration}, + &DirAddEntryPayload{ParentInodeNum: uint64(inode.InodeRoot), ChildInodeNum: 50, EntryType: DirEntryRegular, Name: "made"}, + ) + create.Header.OwnerNodeUUID = tc.owner + if _, err := applyTransaction(ctx, rctx, create); err != nil { + t.Fatal(err) + } + num, err := lookupRoot(t, rctx, "made") + if tc.named && (err != nil || num != 50) { + t.Errorf("entry after replay: %d, %v; want inode 50", num, err) + } + if !tc.named && !errors.Is(err, dir.ErrNotFound) { + t.Errorf("replay named a slot it cannot tell is the create's own: %d, %v", num, err) + } + if ino, err := rctx.InodeTbl.Read(50); tc.named && (err != nil || ino.Mode != inode.S_IFREG|0644) { + t.Errorf("inode 50 after replay: mode %#o, %v", ino.Mode, err) + } + }) + } +} + func TestReplayedCreateFinishesUnclaimedSlot(t *testing.T) { rctx, cleanup := testRecoveryContext(t) defer cleanup() @@ -976,7 +987,7 @@ func TestApplyExtentAddSkipsChangedInode(t *testing.T) { if err := rctx.InodeTbl.Write(ctx, ino); err != nil { t.Fatal(err) } - if applied, err := applyExtentAdd(ctx, rctx, newTxnReplay(), write); err != nil || applied { + if applied, err := applyExtentAdd(ctx, rctx, newTxnReplay([16]byte{}), write); err != nil || applied { t.Fatalf("replay after a truncate = %v, %v; want false, nil", applied, err) } if ino, err := rctx.InodeTbl.Read(50); err != nil || ino.Size != 0 || ino.ExtentCount != 0 { @@ -989,7 +1000,7 @@ func TestApplyDirEntrySkipsRemovedParent(t *testing.T) { rctx, cleanup := testRecoveryContext(t) defer cleanup() ctx := context.Background() - r := newTxnReplay() + r := newTxnReplay([16]byte{}) free, err := rctx.InodeTbl.Read(51) if err != nil { t.Fatal(err) diff --git a/tests/test-manifest.yaml b/tests/test-manifest.yaml index b50d78a7..a3116467 100644 --- a/tests/test-manifest.yaml +++ b/tests/test-manifest.yaml @@ -985,14 +985,67 @@ scenarios: go: internal/goclusterfs/replay_guard_test.go::TestRmdirFreesDirectoryInode - id: crash-between-claim-and-name - name: A crash between claiming a new inode and naming it leaves no shared name - description: A create or mkdir stops after claiming its inode and before adding the name, and a peer creates a file before replay; the peer's file gets its own inode, no two names share an inode, and fsck finds no errors + name: Replay names an inode whose create crashed between the claim and the name + description: A create or mkdir stops after claiming its inode and before adding the name, and a peer creates a file before replay; replay names the claimed inode, a directory gets "." and "..", the peer's file keeps its own inode, and fsck is clean priority: high environments: - go: internal/goclusterfs/name_order_test.go::TestCrashBetweenClaimAndNameLeavesNoSharedName + go: internal/goclusterfs/name_order_test.go::TestCrashBetweenClaimAndNameReplaysTheName docker: TODO # needs a pause between the claim and the name, which only the Go test hook gives vm: TODO # a power failure cannot be timed into the window between the claim and the name without that hook + - id: mkdir-replays-after-crash + name: Replay of an interrupted mkdir makes a complete directory + description: A mkdir stops after its commit and the process dies; replay makes the directory with "." and "..", raises the parent's link count, and fsck is clean + priority: high + environments: + go: internal/goclusterfs/name_order_test.go::TestMkdirReplaysAfterCrash + docker: TODO # needs a pause between commit and the claim, which only the Go test hook gives + vm: TODO # a power failure cannot be timed into the window between commit and the claim without that hook + + - id: remove-races-peer-recreate + name: Unlink and rmdir do not remove a name another node made since their lookup + description: Node B removes a name and makes a new one between node A's lookup and its removal; A returns ENOENT when the new name has another inode, removes the new file whole when it reuses the slot, and fsck is clean + priority: high + environments: + go: internal/goclusterfs/name_order_test.go::TestRemoveRacesPeerRecreate + docker: TODO # needs a pause between one node's lookup and its removal, which only the Go test hook gives + vm: TODO # the race window is too short to hit on purpose without that hook + + - id: unlink-succeeds-while-peer-writes + name: Unlink succeeds while another node writes the file + description: Another node writes the file every time unlink looks it up; the unlink succeeds, every block is freed, and fsck is clean + priority: go_only + environments: + go: internal/goclusterfs/name_order_test.go::TestUnlinkSucceedsWhilePeerWrites + + - id: rmdir-races-peer-adding-entry + name: Rmdir keeps a directory another node adds an entry to + description: Another node adds an entry to the directory between rmdir's emptiness check and its removal; rmdir returns ENOTEMPTY and the directory keeps its name + priority: go_only + environments: + go: internal/goclusterfs/name_order_test.go::TestRmdirRacesPeerAddingEntry + + - id: unlink-frees-blocks-written-after-name-removed + name: Unlink frees blocks written after its name was removed + description: An open handle writes a new block between unlink removing the name and freeing the inode; the free gives back every block, and fsck is clean + priority: go_only + environments: + go: internal/goclusterfs/name_order_test.go::TestUnlinkFreesBlocksWrittenAfterNameRemoved + + - id: create-name-errors + name: A failed name add reports EEXIST or ENOENT + description: Create and mkdir into a taken name return EEXIST, into a removed directory ENOENT, and give back the claimed inode + priority: go_only + environments: + go: internal/goclusterfs/name_order_test.go::TestCreateNameErrors + + - id: replayed-create-finishes-own-claim + name: Replay names a create's own claim only while nothing wrote it since + description: The logging node claimed the slot and wrote it at most as often as a create does; replay adds the name, and leaves a slot another node wrote, or wrote more often, alone + priority: go_only + environments: + go: internal/journal/cross_node_recovery_test.go::TestReplayedCreateFinishesOwnClaim + - id: remove-if-holds-directory-lock name: RemoveIf checks an entry under the directory lock description: A peer node removes the entry while RemoveIf checks it; the peer waits for the directory lock and finds the entry gone