I would better check for file existence anyway cause (a) OS behavior can change in future (i.e. your simplification would play a low-down trick later), and (b) there's often a chance that the file is created outside of your FS on your backend storage. In the latter case you rely on the state which is not more valid.
FUSE: do I need to check for file/dir existence in create/mkdir?
-
29-06-2022 - |
Question
I'm implementing a FUSE-based filesystem (osxfuse, actually, since it's on Mac), and I noticed that before create or mkdir call getattr is always called, and if a node already exists, create/mkdir does not get called. The question is, can I rely on this behavior and not check for existence in create/mkdir?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow