Skip to content

Commit 1f924d1

Browse files
ovaistariqclaude
andcommitted
fix: Remove lock condition from mtime update for consistency
The mtime update logic in the `inode == parent` path was inconsistent with the `inode != parent` paths. In child directories (inode != parent), mtime updates occur regardless of the `lock` parameter. However, parent directories (inode == parent) only updated mtime when lock=true. This inconsistency meant that when lock=false (e.g., called from Rename), parent directories wouldn't get their mtime updated even when new items were found, leading to potentially stale timestamps. Remove the `&& lock` condition to ensure mtime updates happen consistently across all code paths whenever a directory is already sealed but new items are discovered during listing. Fixes review comment from Cursor bot. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent a96adb3 commit 1f924d1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/dir.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ func (parent *Inode) sealChildDirectories(dirs map[*Inode]bool, resp *ListBlobsO
296296
if atomic.LoadUint64(&child.dir.generation) != gen+1 {
297297
// Seal failed validation - directory was modified concurrently
298298
// This should not happen since we hold child.mu, but be defensive
299+
fuseLog.Debugf("Seal failed validation for directory %v: generation=%v expected=%v", child.FullName(), atomic.LoadUint64(&child.dir.generation), gen+1)
299300
}
300301
}
301302
child.mu.Unlock()
@@ -435,8 +436,8 @@ func (parent *Inode) listObjectsSlurp(inode *Inode, startAfter string, sealEnd b
435436
sealSucceeded = parent.sealDirWithValidation()
436437
alreadySealed = !sealSucceeded && parent.dir.listDone
437438

438-
// Special case: if already sealed but got items, update mtime (lock=true only)
439-
if alreadySealed && hasItems && lock {
439+
// Special case: if already sealed but got items, update mtime
440+
if alreadySealed && hasItems {
440441
parent.updateDirectoryMtime()
441442
}
442443

0 commit comments

Comments
 (0)