nfsmount: call mount_nfs directly on OpenBSD so -T is accepted
The previous OpenBSD path built the right options ("-o port=N -T") but
still handed them to mount(8). On OpenBSD "-T" is a mount_nfs(8) flag,
not a mount(8) one, so mount rejected it with "mount: unknown option --
T" and the mount never ran. Call mount_nfs(8) directly on OpenBSD; the
options are already in its native syntax.
Verified on a real OpenBSD 7.9 arm64 VM: with this change the command
becomes "mount_nfs -o port=N -T localhost:/ <mnt>" and mount_nfs accepts
the flags. The mount then fails later with "Stale NFS file handle"
because the OpenBSD client and rclone's in-process NFS server disagree
on the root filehandle - that is a separate issue in the NFS server,
not in the mount options this PR is about.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
committed by
Nick Craig-Wood
co-authored by
Claude Opus 4.8
parent
47fb3c7156
commit
b78a43d05f
@@ -54,16 +54,20 @@ func mount(VFS *vfs.VFS, mountpoint string, opt *mountlib.Options) (asyncerrors
|
||||
return
|
||||
}
|
||||
|
||||
// Options
|
||||
// Options and mount binary
|
||||
//
|
||||
// OpenBSD's mount_nfs(8) doesn't understand "-o mountport=" or "-o
|
||||
// tcp" - the mountd port isn't settable that way and TCP is
|
||||
// requested with the "-T" flag instead, so build a different set of
|
||||
// options there. FreeBSD's mount_nfs(8) accepts the same "-o
|
||||
// port=", "-o mountport=" and "-o tcp" options as Linux so it uses
|
||||
// the common case.
|
||||
// requested with the "-T" flag instead. "-T" is a mount_nfs(8) flag,
|
||||
// not a generic mount(8) one, so on OpenBSD we call mount_nfs(8)
|
||||
// directly; running it through mount(8) makes mount reject "-T" with
|
||||
// "unknown option". FreeBSD's mount_nfs(8) accepts the same "-o
|
||||
// port=", "-o mountport=" and "-o tcp" options as Linux, and mount(8)
|
||||
// there forwards them, so it stays on the common path.
|
||||
mountBin := "mount"
|
||||
var options []string
|
||||
if runtime.GOOS == "openbsd" {
|
||||
mountBin = "mount_nfs"
|
||||
options = []string{
|
||||
"-o", fmt.Sprintf("port=%s", port),
|
||||
"-T",
|
||||
@@ -84,7 +88,7 @@ func mount(VFS *vfs.VFS, mountpoint string, opt *mountlib.Options) (asyncerrors
|
||||
if sudo {
|
||||
cmd = append(cmd, "sudo")
|
||||
}
|
||||
cmd = append(cmd, "mount")
|
||||
cmd = append(cmd, mountBin)
|
||||
cmd = append(cmd, options...)
|
||||
cmd = append(cmd, "localhost:"+mountPath, mountpoint)
|
||||
fs.Debugf(nil, "Running mount command: %q", cmd)
|
||||
|
||||
Reference in New Issue
Block a user