-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
"zfs umount -f" fails when pool is busy #2435
Comments
hm, interesting thanks for coming up with a re-producer and test for that this likely is the behavior I saw on my system: the most probable cause here is gam_server - it doesn't shut down fast enough during shutdown & therefore delays shutting down of additional processes (xfce4, kde4, etc. related) and thus after the next reboot on import attempt I see: zpool status
errors: No known data errors my (preliminary) "solution" is to kill it of via a script in /etc/local.d/ |
The problem here (in both issues) is that Linux don't do force unmounts. The option exist
but it doesn't work. Not like it does in *BSD/Solaris etc anyway... |
This is the key bit. The expected behavior for --force differs between Illumos and Linux. According to the Illumos man page this option will unmount the filesystem but its dangerous and may result in data loss.
Under Linux the --force option means something slightly different and by convention only applies to network filesystems like NFS. It means to unmount the filesystem even if the server is unreachable and therefore we may loose data in our writeback cache. For a local filesystem you can never force unmount it while it has processes actively using it.
However, what you can do on Linux is a lazy unmount. This will remove the filesystem from the mounted namespace so no new processes can access it. However, any process which has file handles open will be able to use them until they close them. Once all open file handles for the filesystem are closed the unmount will complete. There is no Illumos equivalent behavior but this is implemented for ZoL. Although it looks like we need to document that better and perhaps add a
So I don't actually think this is a bug. Everything is working as expected under Linux. What we should probably do is update the test case to either use lazy unmounts.
|
As long as '-f' means 'lazy unmount' (anything else is pointless - we can't forcibly unmount a filesystem) on Linux (and it's documented as such), all should be fine. The problem with 'zfs unmount -f' today, is that it fails - i.e., it does nothing more than 'zfs unmount' (without the '-f'). WIth an error. It shouldn't. It should do a lazy unmount and if that succeeds, then exit with 'ok'.... So maybe the issue should be retitled to something like:
A "zfs unmount -f" is expected to succeed, not fail... |
Maybe. But a lazy unmount isn't equivalent to an Illumos style forced unmount. If we pretend it is this will just cause more confusion. It would be better to remove the force option and add the lazy option since we can never replicate the Illumos force behavior. The Linux VFS enforces this. For example, a lazy unmount may succeed and remove the filesystem from the namespace. However, the super block associated with the filesystem will not be destroyed until the last filesystem user closes their open file handles. That means some operations such as |
Right... Well, then I also vote for removing the -f option (exit with |
@FransUrbo Hello, I have make the zpool use the sdb of a diskarray throw the network. |
@0602114042 This is not a support forum. Please ask your question on the mailing list. And do NOT hijack an issue/thread by asking a completely unrelated question!! This is considered very, very rude! |
crazy question, can we change the Linux VFS behaviour? |
@zfsbot you mean to ( really ) force umount anyway ? |
One way to mitigate this issue would be to update |
@behlendorf do you think retrying a few times help? Is this a temporary race condition which eventually resolves or could the process then try for ever? I have a problem with privates mount namespaces, which do not receives updates from there parent namespace. Systemd creates those to implement private /tmp mounts. |
@Mic92 it depends on on why the mount point is busy. If some process does have a file open in the filesystem it will always return EBUSY. This is the expected behavior for all Linux filesystems. |
somewhat related, not umount, but export, referencing: openzfs/openzfs#175 7301 zpool export -f should be able to interrupt file freeing |
Closing, without directly modifying the Linux kernel this EBUSY behave can't be changed. Therefore, the ZFS Test Suite is being systematically updated to expect this behavior on Linux. The helper functions |
Related to #2434
Way to reproduce:
Results in:
The text was updated successfully, but these errors were encountered: