Skip to content

posixfs tries to stat the lockfile for every entry in a file listing #2745

Open

Description

@butonic

in AsResourceInfo we call hasLocks:

func (n *Node) hasLocks(ctx context.Context) bool {
	for _, p := range n.LockFilePaths() {
		if _, err := os.Stat(p); err == nil { // STAT !!!
			return true
		}
	}
	return false
}

this makes a stat call for every child in the dirlisting.

on a network filesystem like leilfs listing 1000 files looks like this:

Image

when always returning false instead of making the stat call:

Image

In the back, there are two pods with different load. the sfsmount process produces constant load. using an nfs ganesha mount might be better for our use case, but I ran into problems

Under heavy load the problem gets worse ...

Activity

  1. added theissue type on May 12, 2026
  2. aduffeck commented on May 13, 2026

    @aduffeck
    Member

    The problem isn't limited to posixfs, decomposed* also tries to stat the lockfile of each entry. For Posixfs it's twice as severe however because it considers lockfiles both in the metadata dir and the actual file tree, so it's two stats instead of one for each dir entry.

    The file tree locks are only relevant if collaborative mode is enabled however, I'll open a pull request to disable them if it's off.

    For "our" locks we could consider moving the lock state into the file metadata which is nicely cached in nats and is available at that point anyway. That leaves the question how external applications could determin wheter a file is locked or not but that could be solved by adding something like an opencloud lock command, for example.

  3. moved this from Qualification to Prio <= 3 in OpenCloud Team Boardon May 27, 2026
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

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions