Add FreeBSD support - #339
Open
ocochard wants to merge 1 commit into
Open
Conversation
Contributor
|
Hi @ocochard thanks for the PR. We're taking a look at this internally and will let you know when we have updates. |
efs-utils builds and runs on FreeBSD/amd64 and FreeBSD/aarch64. A new mount_efs(8) helper mounts EFS filesystems through the same efs-proxy used on Linux, and the mount-watchdog daemon supervises the proxy as on other platforms. * src/efs_utils_common/mount_options.py: use `nfsv4,minorversion=1` instead of `nfsvers=4.1` (unrecognized by FreeBSD's mount_nfs(8)); add `oneopenown` and `retrycnt=1` per AWS-recommended FreeBSD mount options. * src/efs_utils_common/mount_utils.py: dispatch to /sbin/mount_nfs on FreeBSD. * src/efs_utils_common/proxy.py: detect FreeBSD init as "rc", start the watchdog via `service(8) onestart`; skip SO_BINDTODEVICE in stunnel config generation on FreeBSD. * src/watchdog/__init__.py: /proc/mounts doesn't exist on FreeBSD and neither mount(8) nor nfsstat(8) expose the NFS client's TCP port, so live mounts are tracked by enumerating state files in STATE_FILE_DIR and cross-checking against `mount -t nfs`. To avoid the health-check `df` wedging permanently in unkillable D-state on a kernel vnode lock, track the in-flight `df` subprocess per state file and skip spawning a new one while the prior one is still stuck, capping the leak at one stuck process per mount. To avoid tracking an orphaned efs-proxy/state-file pair left behind by nflx_mount_efs's cold-boot retry as a second live mount, prefer the state file whose port has an ESTABLISHED loopback connection (via `sockstat -4`) so the orphan gets reaped by the existing stale-mount cleanup path instead. * dist/amazon-efs-mount-watchdog.rc: new FreeBSD rc(8) script, companion to the existing systemd unit and launchd plist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes:
efs-utils builds and runs on FreeBSD/amd64 and FreeBSD/aarch64. A new mount_efs(8) helper mounts EFS filesystems through the same efs-proxy used on Linux, and the mount-watchdog daemon supervises the proxy just as it does on other platforms.
FreeBSD differs from Linux in a few places that required targeted adjustments:
src/efs_utils_common/mount_options.py: FreeBSD's mount_nfs(8) does not recognize
nfsvers=4.1; on FreeBSD, passnfsv4,minorversion=1instead so mount_nfs negotiates NFSv4.1. Also addoneopenownandretrycnt=1to match the AWS-recommended FreeBSD EFS mount options.src/efs_utils_common/mount_utils.py: dispatch to /sbin/mount_nfs on FreeBSD
src/efs_utils_common/proxy.py: detect FreeBSD init system as "rc" and start the watchdog with
service(8) onestart. FreeBSD is also added to the SO_BINDTODEVICE-skip list for stunnel config generation.src/watchdog/init.py: /proc/mounts does not exist on FreeBSD, and neither mount(8) nor nfsstat(8) expose the NFS client's TCP port. Enumerate the watchdog's own state files in STATE_FILE_DIR and cross-check against
mount -t nfsto track live mounts. Keying off state files (rather than live proxy sockets) preserves the watchdog's ability to restart a dead efs-proxy.dist/amazon-efs-mount-watchdog.rc: new FreeBSD rc(8) script, companion to the existing systemd unit and launchd plist.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.