-
Notifications
You must be signed in to change notification settings - Fork 14
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
Check for openFileHandles before regular unmount to cancel it #47
Comments
With 663ab4d, the That said, there is not yet any "open file handle counter". |
An easy way to implement the feature is to use the Read/Write-locks. These are applied before nearly every (important) method. hence only if currently no lock is accquired we give the green light to release. |
True. If it is possible to create an exclusive (i.e. write) lock for the root path, we can be sure, no other operation holds a lock. Problem is, that currently there is no "root". Locking starts one level below root, since there has never been the need for file operations on root. |
* adding isNotSafeToUnmount() method to FuseNioAdapter interface * AbstractMount directly implements unmount() and unmountForced() * AbstractMount has two additional _abstract_ methods for internal unmounting * ReadOnlyAdapter implements isNotSafeToUnmount * aborting unmount() if is not safe and throw CommandFailedException
…nels Cancel regular unmount if filesystem is still in use
If a file channel is still open when one executes the unmount method ( which in the end calls the linux helper command
fusermount
), the unmount fails with aCommandFailedException
:fuse-nio-adapter/src/main/java/org/cryptomator/frontend/fuse/mount/AbstractMount.java
Lines 46 to 53 in 4bb19ad
Nonetheless, with the call
fuseAdapter.unmount()
the actual filesystem is marked as not-mounted, make it impossible to recover from the failed regular unmount command:fuse-nio-adapter/src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java
Lines 266 to 273 in 4bb19ad
Additionally, the
CommandFailedException
for thefusermount
only means that the operation did not succeeded, but does not indicate for what reason.I propose to change the regular unmount to _ only_ execute
fusermount
and marking the filesystem as unmounted, if no internal file channels are open and otherwise throw a different exception. If the filesystem need to be unmoutned, theunmountForced()
method can be used.Ideas how to implement can be taken from cryptomator/dokany-nio-adapter@9a65c64
The text was updated successfully, but these errors were encountered: