Open jti-lanl opened 8 years ago
Files are associated with fds if Marfs is written to spec and thus most normal locking functions exist
When operating on a file, the mdfile should be open by the operating process even though you don't read or write into the mdfile This gets us proper behavior for things like unlink
As for locking within a byte range, not sure that matters, if the user chooses to shoot his foot he can do that with posix too, with posix he gets ordering but that's not much help given false sharing
There are some areas where atomic ops would be nice, mostly in the area of batch ops changing metadata that are perhaps worth a chat to minimize the vulnerability
Again, need more info on the concern
From: Brett Kettering notifications@github.com Sent: Wednesday, April 13, 2016 7:22:15 AM To: mar-file-system/marfs Cc: Grider, Gary Alan Subject: Re: [mar-file-system/marfs] should we associate files with fds, and add locking? (#89)
Assigned #89https://github.com/mar-file-system/marfs/issues/89 to @garygriderhttps://github.com/garygrider.
You are receiving this because you were mentioned. Reply to this email directly or view it on GitHubhttps://github.com/mar-file-system/marfs/issues/89#event-625757289
This comes up in 2 places.
( echo test > /marfs/jti/myfile; echo test > /marfs/jti/myfile)
A quick test suggests that adding a 'sync' makes it work, but I'm not sure whether this is absolutely reliable:
( echo test > /marfs/jti/myfile;
sync; echo test > /marfs/jti/myfile)
The heavy-duty fix for both (1) and (2) would be to have all opens do something like the following:
If the filename is not in the table, we'd install it there, associated with the new fd (while the lock was held). If it is in the table, we'd get that fd and then have nightmares about all the ways things can go wrong when one thread is trying to fsync an fd that another thread is using, etc. But this is presumably the kind of thing we'd have to do to handle the NFS behavior described above in (1), assuming I've understood it correctly. Regarding (2), perhaps we can reasonably require users to just never do this. But if they are allowed to do this, then we could detect it in the second open() and wait for the first thread to finish. But that would involve more locking.
So far, we've managed to avoid adding any locking to fuse proper. (There is locking in per-thread interactions with their own object-streams, but that's all.) Also, just because we can make this association doesn't mean we should. It costs us some ugliness, and maybe risks some hard-to-diagnose performance problems, and for what?