Make weed-fuse compatible with systemd-based mount
#6814
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem are we solving?
Currently, weed does not work well with systemd-based mount, including
systemd-fstab-generatorandsystemd.mount/systemd.automount:https://github.com/seaweedfs/seaweedfs/wiki/fstab/948a70df5c0d9d2d27561b96de53bde07a29d2db
The previous PR #6809 has fixed the problem quote
and this PR fixes others, making such as
_netdev,systemd-fstab-generator, andx-systemd.automountto work again.How are we solving the problem?
x-systemd.automountdon't work because automount will mount aautofsto be a placeholder and triggering the actual mount over the same mountpoint when being accessed.e.g.
The default behavior throws error when mountpoint is occupied. We added an
ignoreMountedfield to change the behavior and should be specified in fstab/systemd.mount if used along with systemd automount.The
_netdevis removed from command line, as:while
_netdevitself is used to make the mount unit belongs toremote-fs.target(otherwise it belongs tolocal-fs.target) and we can't remove them from mount options. Theweed fusecommand will remove it as it will have no effect when fuse takes place.We also changed the signal handling on SIGINT/SIGCHLD and file descriptor inheriting to improve debugging.
How is the PR tested?
We test them on an Archlinux system which uses systemd-based mounting system.
Testing systemd automount
We mount it with the following /etc/fstab entry:
which in turn generates following systemd unit:
This is also tested with static mount/automount unit files:
Testing booting with fstab and systemd-fstab-generator
We mount it with the following /etc/fstab entry:
and boots correctly.
Checks