chore: remove tracking inode change time (#10579)

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2026-03-22 20:24:03 -07:00
committed by GitHub
parent 3b05ba2a8f
commit b39c56f82d
15 changed files with 266 additions and 414 deletions
-29
View File
@@ -1789,19 +1789,6 @@ loop:
lastFile = job.file
}
if !job.file.IsDeleted() && !job.file.IsInvalid() {
// Now that the file is finalized, grab possibly updated
// inode change time from disk into the local FileInfo. We
// use this change time to check for changes to xattrs etc
// on next scan.
if err := f.updateFileInfoChangeTime(&job.file); err != nil {
// This means on next scan the likely incorrect change time
// (resp. whatever caused the error) will cause this file to
// change. Log at info level to leave a trace if a user
// notices, but no need to warn
f.sl.Warn("Failed to update metadata at database commit", slogutil.FilePath(job.file.Name), slogutil.Error(err))
}
}
job.file.Sequence = 0
batch.Append(job.file)
@@ -2187,22 +2174,6 @@ func (f *sendReceiveFolder) withLimiter(ctx context.Context, fn func() error) er
return fn()
}
// updateFileInfoChangeTime updates the inode change time in the FileInfo,
// because that depends on the current, new, state of the file on disk.
func (f *sendReceiveFolder) updateFileInfoChangeTime(file *protocol.FileInfo) error {
info, err := f.mtimefs.Lstat(file.Name)
if err != nil {
return err
}
if ct := info.InodeChangeTime(); !ct.IsZero() {
file.InodeChangeNs = ct.UnixNano()
} else {
file.InodeChangeNs = 0
}
return nil
}
// A []FileError is sent as part of an event and will be JSON serialized.
type FileError struct {
Path string `json:"path"`
-3
View File
@@ -647,9 +647,6 @@ func TestDeleteIgnorePerms(t *testing.T) {
fi, err := scanner.CreateFileInfo(stat, name, ffs, false, false, config.XattrFilter{})
must(t, err)
ffs.Chmod(name, 0o600)
if info, err := ffs.Stat(name); err == nil {
fi.InodeChangeNs = info.InodeChangeTime().UnixNano()
}
scanChan := make(chan string, 1)
err = f.checkToBeDeleted(fi, fi, true, scanChan)
must(t, err)