Skip to content

posix: notice setfacl and chattr fixes on files that failed to assimilate #805

Closed

Description

@NickWalters

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>/
  1. The watcher picks up the file and fails: failed to set ... xattrs ... permission denied.
  2. 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.
  3. 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 current Record, each change also resets the delay to 1 minute. Record could keep the doubled delay when only the ctime changed, so each change costs one read.
  • The regression spec in tree_non_watching_test.go finds 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 the rchar counter in /proc/self/io, with a skip on systems that don't have it.

Activity

  1. NickWalters commented on Oct 6, 2026

    @NickWalters
    Author

    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:

    item is unchanged since it failed to assimilate, not retrying before 2026-10-06T05:17:30Z: failed to set 10/10 xattrs: ... permission denied
    

    I fixed them with setfacl -m g::rwX. That changes no mode, uid or gid, so Failures.Recent keeps 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+w only widens the mask, so ls shows -rw-rw-r-- while group:: is still r--.

  2. added a commit that references this issue on Oct 14, 2026
    48eb013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions