Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadlock on syscalls like rename() and sendfile() #2

Open
dimakuv opened this issue Mar 12, 2021 · 2 comments
Open

Deadlock on syscalls like rename() and sendfile() #2

dimakuv opened this issue Mar 12, 2021 · 2 comments

Comments

@dimakuv
Copy link

dimakuv commented Mar 12, 2021

When a syscall operates on two files, there seems to be a possibility of a deadlock.

A trivial example would be:

  1. First process does rename("foo.txt", "bar.txt")
  2. Second process does rename("bar.txt", "foo.txt")

Roughly at the same time. Another example would be sendfile().

Or maybe there is no problem actually? The Server can impose some ordering to prevent deadlocks?

@pwmarcz
Copy link
Owner

pwmarcz commented Mar 12, 2021

I'm assuming the objects have some kind of IDs (ideally strings, so you can incorporate path), so maybe we could use that to take locks in order? That doesn't even have to be imposed by server.

@mkow
Copy link

mkow commented Mar 18, 2021

Lock hierarchy sounds doable, but you need to be careful and normalize paths and document that this assumes we can't have two views of the same files in the filesystem (i.e. you can't have the same directory mounted in two places).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants