Repository navigation
Description
This is a follow-up to #796.
#796 skips a file that failed to assimilate while its mtime, size, mode, uid and gid stay the same. The retry delay starts at 1 minute and doubles up to 24h. A fix that changes none of these fields goes unnoticed until the next retry or a restart. setfacl and chattr -i are examples. A copy that replaces the file with the same mtime, size, mode and owner also waits for the retry.
Steps to reproduce
On a posix space with the watcher on. opencloud is the service user's group, and the service user doesn't own the file. Run as root, in a folder on the same filesystem as the storage but outside any space:
echo hi > f.txt
chown root:opencloud f.txt && chmod 664 f.txt
setfacl -m g::r--,m::rw- f.txt # the group entry is read-only, but ls still shows -rw-rw-r--
mv f.txt <folder in the space>/- The watcher picks up the file and fails:
failed to set ... xattrs ... permission denied. - Fix the ACL with
setfacl -m g::rw- <folder in the space>/f.txt. The mode, owner, size and mtime stay the same. Only the ctime changes. - Open the folder in OpenCloud. The log shows
item is unchanged since it failed to assimilate, not retrying before <time>, and the file isn't assimilated until that time or a restart.
Idea
Record could stat the file again after the failed attempt and keep that ctime. unchanged would then compare the current ctime with it too. #796 doesn't compare the ctime from before the attempt, because the xattr writes that succeed change it. A file where only some of the writes fail would then loop again. A ctime from after the attempt already includes those writes, so this problem goes away.
Any change after the failure then changes the ctime, and the next scan tries the file again. That covers setfacl, chattr and a rename over the path. timemanager.StatCTime already reads the ctime on Linux and BSD.
Costs
- Harmless metadata changes also cause a retry, for example
touch -a, a backup tool that restores access times, or another program that writes xattrs. With the currentRecord, each change also resets the delay to 1 minute.Recordcould keep the doubled delay when only the ctime changed, so each change costs one read. - The regression spec in
tree_non_watching_test.gofinds reads through the access time (atime). It resets the atime before each listing, and that also changes the ctime. I tried a quick version of this idea, and the spec failed for that reason. The spec needs another way to find reads. One option is a bigger file and thercharcounter in/proc/self/io, with a skip on systems that don't have it.
Activity
NickWalters commentedon Oct 6, 2026
A real case for this one, from OpenCloud 8.1.0 (reva v2.51.0) today.
136 files in a posix space carried their own POSIX ACL with
group::r--. The service user is in that group, but couldn't write its xattrs, so each file failed once and went into the backoff:I fixed them with
setfacl -m g::rwX. That changes no mode, uid or gid, soFailures.Recentkeeps treating every file as unchanged until its retry time comes, even though the cause is gone. Their ctime does change, which is what this issue proposes to compare. I restarted to pick them up, and all 136 were assimilated.A side note on why this is easy to hit: on a file with an ACL,
chmod g+wonly widens the mask, solsshows-rw-rw-r--whilegroup::is stillr--.fix(posix): retry a failed file once its ctime changes