From d9f5496fa80446e8f23ace7fd7a2316553350842 Mon Sep 17 00:00:00 2001 From: Matthew Mattox Date: Sat, 24 Oct 2026 17:36:13 -0500 Subject: [PATCH 1/6] test: create files on two nodes while their directory grows Co-Authored-By: Claude Opus 5.5 --- tests/integration/multinode_test.go | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/integration/multinode_test.go b/tests/integration/multinode_test.go index a95a7a96..c2fbbeee 100644 --- a/tests/integration/multinode_test.go +++ b/tests/integration/multinode_test.go @@ -7,6 +7,7 @@ import ( "fmt" "math/rand" "os" + "strings" "sync" "syscall" "testing" @@ -308,6 +309,59 @@ func TestMultiNodeCrashRecovery(t *testing.T) { t.Log("Crash recovery test completed - filesystem remains functional after crash") } +// TestMultiNodeCreateDuringDirectoryGrowth checks that no entries are lost when two +// nodes create files in one directory while it grows past its first block. +func TestMultiNodeCreateDuringDirectoryGrowth(t *testing.T) { + cluster := NewMultiNodeCluster(t, 2, 50) + if err := cluster.FormatAndStartFirst(false); err != nil { + t.Fatalf("Failed to format and start first node: %v", err) + } + if err := cluster.StartNode(1, false); err != nil { + t.Fatalf("Failed to start second node: %v", err) + } + + // 255-byte names fit 3840 entries in a 1 MB directory block; the volume has 4093 free inodes. + const perNode = 2000 + prefix := strings.Repeat("x", 248) + name := func(node, i int) string { return fmt.Sprintf("%s-%d-%04d", prefix, node, i) } + + errs := cluster.RunConcurrent([]int{0, 1}, func(idx int, node *MountedFS) error { + for i := 0; i < perNode; i++ { + if err := node.WriteFile(name(idx, i), nil); err != nil { + return fmt.Errorf("create %d: %w", i, err) + } + } + return nil + }) + for idx, err := range errs { + if err != nil { + t.Fatalf("Node %d: %v", idx, err) + } + } + + for idx := 0; idx < 2; idx++ { + entries, err := cluster.Node(idx).ReadDir("") + if err != nil { + t.Fatalf("Node %d: list root: %v", idx, err) + } + seen := make(map[string]bool, len(entries)) + for _, e := range entries { + seen[e.Name()] = true + } + missing := 0 + for node := 0; node < 2; node++ { + for i := 0; i < perNode; i++ { + if !seen[name(node, i)] { + missing++ + } + } + } + if missing > 0 { + t.Errorf("Node %d lists %d entries; %d of %d created files are missing", idx, len(entries), missing, 2*perNode) + } + } +} + // TestMultiNodeConcurrentDirectoryOps tests multiple nodes performing directory operations // concurrently. Both nodes create files in the root directory and verify all files appear. func TestMultiNodeConcurrentDirectoryOps(t *testing.T) { From 272b69c2b6ea34a0cdea2e0fd2f63f9db19a7f60 Mon Sep 17 00:00:00 2001 From: Matthew Mattox Date: Sat, 24 Oct 2026 17:37:48 -0500 Subject: [PATCH 2/6] fix(fs): hold the inode lock across directory time and link-count updates Create, mkdir, unlink, rmdir and their Dir variants re-read the parent inode without its lock, then wrote it back to set Mtime or LinkCount. If another node's dir.Add grew the directory to a new block in between, the write-back reverted the directory's Size and extents: the new entries vanished and their block leaked. Unlink's child LinkCount update could likewise revert another node's write to the file. updateInodeLocked holds the local and cluster inode locks from the read to the write. It is only for updates that touch no extents, since freeing blocks under the inode lock would break the lock order. Co-Authored-By: Claude Opus 5.5 --- internal/goclusterfs/fs.go | 43 ++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/internal/goclusterfs/fs.go b/internal/goclusterfs/fs.go index 87e5c32d..8d6b7bb8 100644 --- a/internal/goclusterfs/fs.go +++ b/internal/goclusterfs/fs.go @@ -332,6 +332,31 @@ func (f *FS) updateInode(ctx context.Context, num uint32, update func(*inode.Ino } } +// updateInodeLocked is updateInode for changes that touch no extents or blocks, +// such as times and link counts. It holds the inode's lock from the read to the +// write, so it cannot write back an inode that another node changed in between. +func (f *FS) updateInodeLocked(ctx context.Context, num uint32, update func(*inode.Inode) error) (*inode.Inode, error) { + defer f.lockInode(num)() + if f.lockMgr != nil { + if err := f.lockMgr.Acquire(ctx, lock.LockTypeInode, uint64(num), lock.LockModeExclusive); err != nil { + return nil, fmt.Errorf("failed to acquire inode lock: %w", err) + } + defer f.lockMgr.Release(lock.LockTypeInode, uint64(num)) + } + + ino, err := f.inodeTbl.Read(num) + if err != nil { + return nil, err + } + if err := update(ino); err != nil { + return nil, err + } + if err := f.inodeTbl.WriteWithLockHeld(ino); err != nil { + return nil, err + } + return ino, nil +} + // invalidateInode removes an inode from the cache before modification. // Safe to call even if cache is nil. func (f *FS) invalidateInode(inodeNum uint32) { @@ -719,7 +744,7 @@ func (f *FS) createFileInternal(ctx context.Context, name string, flags uint32, // dirMgr.Add() may have allocated a new block and updated extent fields. // Only Size is copied back to dirIno; extent fields are stale. // Writing the stale dirIno would overwrite the correct extent data on disk. - dirIno, err = f.updateInode(ctx, inode.InodeRoot, func(ino *inode.Inode) error { ino.Mtime = now; return nil }) + dirIno, err = f.updateInodeLocked(ctx, inode.InodeRoot, func(ino *inode.Inode) error { ino.Mtime = now; return nil }) if err != nil { log.Printf("[DEBUG] Create %q: updating root inode failed: %v", name, err) // The file was created successfully, just log the error @@ -876,7 +901,7 @@ func (f *FS) mkdirInternal(ctx context.Context, name string, mode uint32, out *f // dirMgr.Add() may have allocated a new block and updated extent fields. // Only Size is copied back to dirIno; extent fields are stale. // Writing the stale dirIno would overwrite the correct extent data on disk. - dirIno, err = f.updateInode(ctx, inode.InodeRoot, func(ino *inode.Inode) error { + dirIno, err = f.updateInodeLocked(ctx, inode.InodeRoot, func(ino *inode.Inode) error { ino.LinkCount++ ino.Mtime = now return nil @@ -987,7 +1012,7 @@ func (f *FS) Unlink(ctx context.Context, name string) syscall.Errno { if sfbBacked { f.freeSFBSlot(ctx, sfbSlot) } - } else if _, err := f.updateInode(ctx, childIno.InodeNum, func(ino *inode.Inode) error { + } else if _, err := f.updateInodeLocked(ctx, childIno.InodeNum, func(ino *inode.Inode) error { ino.LinkCount-- ino.Ctime = now return nil @@ -995,7 +1020,7 @@ func (f *FS) Unlink(ctx context.Context, name string) syscall.Errno { log.Printf("[DEBUG] Unlink %q: updating link count failed: %v", name, err) } - if _, err := f.updateInode(ctx, dirIno.InodeNum, func(ino *inode.Inode) error { ino.Mtime = now; return nil }); err != nil { + if _, err := f.updateInodeLocked(ctx, dirIno.InodeNum, func(ino *inode.Inode) error { ino.Mtime = now; return nil }); err != nil { log.Printf("[DEBUG] Unlink %q: updating directory failed: %v", name, err) } @@ -1072,7 +1097,7 @@ func (f *FS) Rmdir(ctx context.Context, name string) syscall.Errno { f.inodeTbl.Free(ctx, childIno.InodeNum) now := time.Now().UnixNano() - if _, err := f.updateInode(ctx, dirIno.InodeNum, func(ino *inode.Inode) error { + if _, err := f.updateInodeLocked(ctx, dirIno.InodeNum, func(ino *inode.Inode) error { ino.LinkCount-- ino.Mtime = now return nil @@ -1423,7 +1448,7 @@ func (d *Dir) createInternal(ctx context.Context, name string, flags uint32, mod // dirMgr.Add() may have allocated a new block and updated extent fields. // Only Size is copied back to dirIno; extent fields are stale. // Writing the stale dirIno would overwrite the correct extent data on disk. - dirIno, err = d.fs.updateInode(ctx, d.inodeNum, func(ino *inode.Inode) error { ino.Mtime = now; return nil }) + dirIno, err = d.fs.updateInodeLocked(ctx, d.inodeNum, func(ino *inode.Inode) error { ino.Mtime = now; return nil }) if err != nil { log.Printf("[DEBUG] Create %q: updating parent inode %d failed: %v", name, d.inodeNum, err) // The file was created successfully, just log the error @@ -1640,7 +1665,7 @@ func (d *Dir) mkdirInternal(ctx context.Context, name string, mode uint32, out * // dirMgr.Add() may have allocated a new block and updated extent fields. // Only Size is copied back to dirIno; extent fields are stale. // Writing the stale dirIno would overwrite the correct extent data on disk. - dirIno, err = d.fs.updateInode(ctx, d.inodeNum, func(ino *inode.Inode) error { + dirIno, err = d.fs.updateInodeLocked(ctx, d.inodeNum, func(ino *inode.Inode) error { // Increment parent link count (for ..) ino.LinkCount++ ino.Mtime = now @@ -1857,7 +1882,7 @@ func (d *Dir) removeEntry(ctx context.Context, name string, isDir bool) syscall. if sfbBacked { d.fs.freeSFBSlot(ctx, sfbSlot) } - } else if updated, err := d.fs.updateInode(ctx, uint32(childInodeNum), func(ino *inode.Inode) error { ino.LinkCount--; return nil }); err != nil { + } else if updated, err := d.fs.updateInodeLocked(ctx, uint32(childInodeNum), func(ino *inode.Inode) error { ino.LinkCount--; return nil }); err != nil { log.Printf("[DEBUG] removeEntry %q: updating link count failed: %v", name, err) } else { // Cache the updated child inode @@ -1866,7 +1891,7 @@ func (d *Dir) removeEntry(ctx context.Context, name string, isDir bool) syscall. // Update directory mtime, and its link count for directory removal now := time.Now().UnixNano() - if updated, err := d.fs.updateInode(ctx, d.inodeNum, func(ino *inode.Inode) error { + if updated, err := d.fs.updateInodeLocked(ctx, d.inodeNum, func(ino *inode.Inode) error { if isDir { ino.LinkCount-- } From dbadd256056717b0b690527a90210b83a3f99464 Mon Sep 17 00:00:00 2001 From: Matthew Mattox Date: Sat, 24 Oct 2026 17:40:09 -0500 Subject: [PATCH 3/6] test: grow many small directories while two nodes create in them Each directory block holds only 15 entries with 255-byte names, and growing a directory past two non-contiguous blocks fails on its own (extent tree block allocation under the inode lock), so the test grows 50 directories from one block to two. Co-Authored-By: Claude Opus 5.5 --- tests/integration/multinode_test.go | 54 +++++++++++++++-------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/tests/integration/multinode_test.go b/tests/integration/multinode_test.go index c2fbbeee..282e2f60 100644 --- a/tests/integration/multinode_test.go +++ b/tests/integration/multinode_test.go @@ -320,44 +320,46 @@ func TestMultiNodeCreateDuringDirectoryGrowth(t *testing.T) { t.Fatalf("Failed to start second node: %v", err) } - // 255-byte names fit 3840 entries in a 1 MB directory block; the volume has 4093 free inodes. - const perNode = 2000 + // A directory block holds 15 entries with 255-byte names, so 20 creates grow + // each directory to exactly two blocks. Each directory is one chance to race. + const dirs, perNode = 50, 10 prefix := strings.Repeat("x", 248) - name := func(node, i int) string { return fmt.Sprintf("%s-%d-%04d", prefix, node, i) } + name := func(d, node, i int) string { return fmt.Sprintf("d%02d/%s-%d-%04d", d, prefix, node, i) } - errs := cluster.RunConcurrent([]int{0, 1}, func(idx int, node *MountedFS) error { - for i := 0; i < perNode; i++ { - if err := node.WriteFile(name(idx, i), nil); err != nil { - return fmt.Errorf("create %d: %w", i, err) - } + for d := 0; d < dirs; d++ { + if err := cluster.Node(0).Mkdir(fmt.Sprintf("d%02d", d)); err != nil { + t.Fatalf("mkdir d%02d: %v", d, err) } - return nil - }) - for idx, err := range errs { - if err != nil { - t.Fatalf("Node %d: %v", idx, err) + errs := cluster.RunConcurrent([]int{0, 1}, func(idx int, node *MountedFS) error { + for i := 0; i < perNode; i++ { + if err := node.WriteFile(name(d, idx, i), nil); err != nil { + return fmt.Errorf("d%02d create %d: %w", d, i, err) + } + } + return nil + }) + for idx, err := range errs { + if err != nil { + t.Fatalf("Node %d: %v", idx, err) + } } } + // Lookups use each node's cached directory inode, which is revalidated after 5s. + time.Sleep(6 * time.Second) for idx := 0; idx < 2; idx++ { - entries, err := cluster.Node(idx).ReadDir("") - if err != nil { - t.Fatalf("Node %d: list root: %v", idx, err) - } - seen := make(map[string]bool, len(entries)) - for _, e := range entries { - seen[e.Name()] = true - } missing := 0 - for node := 0; node < 2; node++ { - for i := 0; i < perNode; i++ { - if !seen[name(node, i)] { - missing++ + for d := 0; d < dirs; d++ { + for node := 0; node < 2; node++ { + for i := 0; i < perNode; i++ { + if !cluster.Node(idx).Exists(name(d, node, i)) { + missing++ + } } } } if missing > 0 { - t.Errorf("Node %d lists %d entries; %d of %d created files are missing", idx, len(entries), missing, 2*perNode) + t.Errorf("Node %d: %d of %d created files are missing", idx, missing, dirs*2*perNode) } } } From 4da496e3167450f4f9029c168c95f5523585f815 Mon Sep 17 00:00:00 2001 From: Matthew Mattox Date: Sat, 24 Oct 2026 17:41:32 -0500 Subject: [PATCH 4/6] test: give the directory growth test room for 100 directory blocks Co-Authored-By: Claude Opus 5.5 --- tests/integration/multinode_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/multinode_test.go b/tests/integration/multinode_test.go index 282e2f60..72a41cd6 100644 --- a/tests/integration/multinode_test.go +++ b/tests/integration/multinode_test.go @@ -312,7 +312,7 @@ func TestMultiNodeCrashRecovery(t *testing.T) { // TestMultiNodeCreateDuringDirectoryGrowth checks that no entries are lost when two // nodes create files in one directory while it grows past its first block. func TestMultiNodeCreateDuringDirectoryGrowth(t *testing.T) { - cluster := NewMultiNodeCluster(t, 2, 50) + cluster := NewMultiNodeCluster(t, 2, 200) if err := cluster.FormatAndStartFirst(false); err != nil { t.Fatalf("Failed to format and start first node: %v", err) } @@ -320,8 +320,8 @@ func TestMultiNodeCreateDuringDirectoryGrowth(t *testing.T) { t.Fatalf("Failed to start second node: %v", err) } - // A directory block holds 15 entries with 255-byte names, so 20 creates grow - // each directory to exactly two blocks. Each directory is one chance to race. + // A 1 MB directory block holds 15 entries with 255-byte names, so 20 creates + // grow each directory to exactly two blocks. Each directory is one chance to race. const dirs, perNode = 50, 10 prefix := strings.Repeat("x", 248) name := func(d, node, i int) string { return fmt.Sprintf("d%02d/%s-%d-%04d", d, prefix, node, i) } From 34e78e7a79fce19a36debc4eecd04d4793782dfd Mon Sep 17 00:00:00 2001 From: Matthew Mattox Date: Sat, 24 Oct 2026 17:59:55 -0500 Subject: [PATCH 5/6] test: replace the directory growth tests with a two-node unit test On main, a directory growing between the read and the write is already caught: every inode write compares the on-disk extents with the ones it read and retries on a change (staleExtents, from #8). The growth tests passed without the fix and failed only on slot collisions and lock timeouts. What the lock still protects is fields outside the extents, such as a parent's link count, so test that directly with two nodes interleaved inside the update. Co-Authored-By: Claude Opus 5.5 --- internal/goclusterfs/inode_update_test.go | 50 ++++++++++++++++++++ tests/integration/multinode_test.go | 56 ----------------------- tests/test-manifest.yaml | 7 +++ 3 files changed, 57 insertions(+), 56 deletions(-) create mode 100644 internal/goclusterfs/inode_update_test.go diff --git a/internal/goclusterfs/inode_update_test.go b/internal/goclusterfs/inode_update_test.go new file mode 100644 index 00000000..ed84604d --- /dev/null +++ b/internal/goclusterfs/inode_update_test.go @@ -0,0 +1,50 @@ +package goclusterfs + +import ( + "context" + "testing" + "time" + + "github.com/supporttools/GoClusterFS/internal/inode" +) + +// TestUpdateInodeLockedWaitsForOtherNode runs another node's link count update +// between this node's read and write of the root directory inode. Neither +// update may be lost. +func TestUpdateInodeLockedWaitsForOtherNode(t *testing.T) { + path := newFormattedImage(t) + nodeA, nodeB := openFormattedFS(t, path), openFormattedFS(t, path) + ctx := context.Background() + increment := func(ino *inode.Inode) error { ino.LinkCount++; return nil } + + before, err := nodeA.inodeTbl.Read(inode.InodeRoot) + if err != nil { + t.Fatal(err) + } + + otherDone := make(chan error, 1) + _, err = nodeA.updateInodeLocked(ctx, inode.InodeRoot, func(ino *inode.Inode) error { + go func() { + _, err := nodeB.updateInodeLocked(ctx, inode.InodeRoot, increment) + otherDone <- err + }() + // Without the lock, node B reads and writes the inode in this window. + time.Sleep(200 * time.Millisecond) + return increment(ino) + }) + if err != nil { + t.Fatalf("node A update: %v", err) + } + if err := <-otherDone; err != nil { + t.Fatalf("node B update: %v", err) + } + + after, err := nodeA.inodeTbl.Read(inode.InodeRoot) + if err != nil { + t.Fatal(err) + } + if after.LinkCount != before.LinkCount+2 { + t.Errorf("root link count %d after two increments from %d, want %d", + after.LinkCount, before.LinkCount, before.LinkCount+2) + } +} diff --git a/tests/integration/multinode_test.go b/tests/integration/multinode_test.go index 72a41cd6..a95a7a96 100644 --- a/tests/integration/multinode_test.go +++ b/tests/integration/multinode_test.go @@ -7,7 +7,6 @@ import ( "fmt" "math/rand" "os" - "strings" "sync" "syscall" "testing" @@ -309,61 +308,6 @@ func TestMultiNodeCrashRecovery(t *testing.T) { t.Log("Crash recovery test completed - filesystem remains functional after crash") } -// TestMultiNodeCreateDuringDirectoryGrowth checks that no entries are lost when two -// nodes create files in one directory while it grows past its first block. -func TestMultiNodeCreateDuringDirectoryGrowth(t *testing.T) { - cluster := NewMultiNodeCluster(t, 2, 200) - if err := cluster.FormatAndStartFirst(false); err != nil { - t.Fatalf("Failed to format and start first node: %v", err) - } - if err := cluster.StartNode(1, false); err != nil { - t.Fatalf("Failed to start second node: %v", err) - } - - // A 1 MB directory block holds 15 entries with 255-byte names, so 20 creates - // grow each directory to exactly two blocks. Each directory is one chance to race. - const dirs, perNode = 50, 10 - prefix := strings.Repeat("x", 248) - name := func(d, node, i int) string { return fmt.Sprintf("d%02d/%s-%d-%04d", d, prefix, node, i) } - - for d := 0; d < dirs; d++ { - if err := cluster.Node(0).Mkdir(fmt.Sprintf("d%02d", d)); err != nil { - t.Fatalf("mkdir d%02d: %v", d, err) - } - errs := cluster.RunConcurrent([]int{0, 1}, func(idx int, node *MountedFS) error { - for i := 0; i < perNode; i++ { - if err := node.WriteFile(name(d, idx, i), nil); err != nil { - return fmt.Errorf("d%02d create %d: %w", d, i, err) - } - } - return nil - }) - for idx, err := range errs { - if err != nil { - t.Fatalf("Node %d: %v", idx, err) - } - } - } - - // Lookups use each node's cached directory inode, which is revalidated after 5s. - time.Sleep(6 * time.Second) - for idx := 0; idx < 2; idx++ { - missing := 0 - for d := 0; d < dirs; d++ { - for node := 0; node < 2; node++ { - for i := 0; i < perNode; i++ { - if !cluster.Node(idx).Exists(name(d, node, i)) { - missing++ - } - } - } - } - if missing > 0 { - t.Errorf("Node %d: %d of %d created files are missing", idx, missing, dirs*2*perNode) - } - } -} - // TestMultiNodeConcurrentDirectoryOps tests multiple nodes performing directory operations // concurrently. Both nodes create files in the root directory and verify all files appear. func TestMultiNodeConcurrentDirectoryOps(t *testing.T) { diff --git a/tests/test-manifest.yaml b/tests/test-manifest.yaml index 72b6c95f..bc82fec4 100644 --- a/tests/test-manifest.yaml +++ b/tests/test-manifest.yaml @@ -1355,6 +1355,13 @@ scenarios: environments: go: internal/cache/extent_cache_test.go::TestGetExtentCountsStaleEntryAsMiss + - id: inode-update-locked-two-nodes + name: Locked inode update waits for another node + description: Another node's link count update between this node's read and write of a directory inode is not lost + priority: go_only + environments: + go: internal/goclusterfs/inode_update_test.go::TestUpdateInodeLockedWaitsForOtherNode + - id: broadcast-ignore-own name: Broadcast ignores own messages description: Broadcaster ignores messages from itself From 3378569ace9a97c0071dccef3af0e55a3c48acf1 Mon Sep 17 00:00:00 2001 From: Matthew Mattox Date: Sat, 24 Oct 2026 18:09:10 -0500 Subject: [PATCH 6/6] fix(fs): log skipped link count updates at WARN with the inode number A skipped link count change leaves an inconsistency that fsck reports, so operators need to find it in the log. Co-Authored-By: Claude Opus 5.5 --- internal/goclusterfs/fs.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/goclusterfs/fs.go b/internal/goclusterfs/fs.go index 8d6b7bb8..0fc3a4c0 100644 --- a/internal/goclusterfs/fs.go +++ b/internal/goclusterfs/fs.go @@ -907,7 +907,7 @@ func (f *FS) mkdirInternal(ctx context.Context, name string, mode uint32, out *f return nil }) if err != nil { - log.Printf("[DEBUG] Mkdir %q: updating root inode failed: %v", name, err) + log.Printf("[WARN] Mkdir %q: link count of directory inode %d not updated: %v", name, inode.InodeRoot, err) // The child directory was created successfully, just log the error } else { // Broadcast invalidation so other nodes refresh their directory cache @@ -1017,7 +1017,7 @@ func (f *FS) Unlink(ctx context.Context, name string) syscall.Errno { ino.Ctime = now return nil }); err != nil { - log.Printf("[DEBUG] Unlink %q: updating link count failed: %v", name, err) + log.Printf("[WARN] Unlink %q: link count of inode %d not updated: %v", name, childIno.InodeNum, err) } if _, err := f.updateInodeLocked(ctx, dirIno.InodeNum, func(ino *inode.Inode) error { ino.Mtime = now; return nil }); err != nil { @@ -1102,7 +1102,7 @@ func (f *FS) Rmdir(ctx context.Context, name string) syscall.Errno { ino.Mtime = now return nil }); err != nil { - log.Printf("[DEBUG] Rmdir %q: updating directory failed: %v", name, err) + log.Printf("[WARN] Rmdir %q: link count of directory inode %d not updated: %v", name, dirIno.InodeNum, err) } // === WAL: Mark intent complete === @@ -1672,7 +1672,7 @@ func (d *Dir) mkdirInternal(ctx context.Context, name string, mode uint32, out * return nil }) if err != nil { - log.Printf("[DEBUG] Mkdir %q: updating parent inode %d failed: %v", name, d.inodeNum, err) + log.Printf("[WARN] Mkdir %q: link count of directory inode %d not updated: %v", name, d.inodeNum, err) // The child directory was created successfully, just log the error // and skip updating parent LinkCount/Mtime } else { @@ -1883,7 +1883,7 @@ func (d *Dir) removeEntry(ctx context.Context, name string, isDir bool) syscall. d.fs.freeSFBSlot(ctx, sfbSlot) } } else if updated, err := d.fs.updateInodeLocked(ctx, uint32(childInodeNum), func(ino *inode.Inode) error { ino.LinkCount--; return nil }); err != nil { - log.Printf("[DEBUG] removeEntry %q: updating link count failed: %v", name, err) + log.Printf("[WARN] removeEntry %q: link count of inode %d not updated: %v", name, childInodeNum, err) } else { // Cache the updated child inode d.fs.cacheInode(updated) @@ -1898,7 +1898,7 @@ func (d *Dir) removeEntry(ctx context.Context, name string, isDir bool) syscall. ino.Mtime = now return nil }); err != nil { - log.Printf("[DEBUG] removeEntry %q: updating directory failed: %v", name, err) + log.Printf("[WARN] removeEntry %q: directory inode %d not updated: %v", name, d.inodeNum, err) } else { // Cache the updated parent directory inode d.fs.cacheInode(updated)