Giter Club home page Giter Club logo

Comments (4)

tchajed avatar tchajed commented on July 2, 2024

This code unlinks an open file and then issues an fsync against the old fd; the rename orphans fd_foo.

FSCQ's specification doesn't model open file descriptors to even capture this situation, and FUSE would make it difficult to say what the actual behavior would be anyway.

If you fsync and close fd_foo before unlinking A/foo then FSCQ performs this rename correctly.

from fscq.

squizz617 avatar squizz617 commented on July 2, 2024

I see. Thanks for the comment.

An interesting observation is that rename succeeds when the same test case is executed on many other file systems, including ext4, xfs, btrfs, and f2fs.

As you would probably know, POSIX entry for unlink states that "if one or more processes have the file open when the last link is removed, the link shall be removed before unlink() returns, but the removal of the file contents shall be postponed until all references to the file are closed."

So, does this mismatch of behaviors is something that result from different interpretation of POSIX specs?

from fscq.

tchajed avatar tchajed commented on July 2, 2024

FSCQ doesn't fully implement POSIX, especially around file handles. As you point out, the standard is clear for this example, and FSCQ deviates from the standard. Part of this is due to the complexity of modeling interactions with the operating system (eg, processes each have a directory handle to the current working directory, which needs to be modeled, not to mention their open file handles). Part of it is also that the interaction with FUSE makes it even more difficult to have full control over how a filesystem interacts with the OS.

This issue is somewhat fixable If you pass the option hard_remove as part of the -o argument to fscq. The issue is that FUSE by default implements unlink when there are open handles as a rename to .fuse_hiddenXXXXX, so that the filesystem doesn't have to deal with deleting a file's contents only when the last handle is closed. This generally makes FSCQ work closer to the POSIX standard; if you turn on hard_remove, interacting with an open but unlinked file will fail, which is also not POSIX compliant.

You might want to try running the fuse passthrough filesystem on top of ext4 and seeing what that does, especially with a variety of FUSE configurations (that is, read the options on fuse.h and see what you can toggle). I wouldn't be surprised if you find a lot of bugs there.

from fscq.

tchajed avatar tchajed commented on July 2, 2024

Closing. This behavior falls outside FSCQ's specification. It would be difficult to match other filesystems while using the existing FUSE interface, and I'm not sure FUSE filesystems are ever compliant in the way you're expecting.

from fscq.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.