-
Notifications
You must be signed in to change notification settings - Fork 13
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
Intention behind fsync_recursive
#335
Comments
Somewhat related: This will also get denied be SELinux |
If I remember correctly, I found the idea in another file system-related library that was implemented by a filesystem expert. I think it is okay not to call fsync in parent directories.
It sounds like we shouldn't use the fsync_recursive function on SELinux. Let's turn it off on the environment. Do you know how to detect SELinux in C++ code? If it is not easy, we could turn off the feature in any environment. |
I don't think its possible, at least not in a robust way. Do you think it would be enough to fsync up to the datastore base directory? |
I did some investigation. Calling fsync all up to the root may be overkill. I changed the code to fsync only a parent directory. |
Hi, there is this function
fsync_recursive
which walks up the directory tree until it reaches the root andfsync
s everything in between.metall/include/metall/detail/file.hpp
Lines 72 to 85 in 1f6c027
This behaviour causes issues on SELinux systems when metall is used as part of a system service. The reason being that SELinux will not allow system services to read files that are not theirs.
If you assume that your data is in
/var/local/service/data
this causes issues as soon as metall tries to fsync/var/local
as it will not have access to it with a properly configured policy (because there is no reason for it to have access there).So I was wondering what the intention of that function is: Why does it sync all the way towards the root directory? Would it be enough to only
fsync
up to the datastore root?Example strace:
The text was updated successfully, but these errors were encountered: