diff --git a/drivers/zfs/zfs_freebsd.go b/drivers/zfs/zfs_freebsd.go index fd98ad305c..61a2ed871a 100644 --- a/drivers/zfs/zfs_freebsd.go +++ b/drivers/zfs/zfs_freebsd.go @@ -2,7 +2,6 @@ package zfs import ( "fmt" - "strings" "github.com/containers/storage/drivers" "github.com/pkg/errors" @@ -26,19 +25,10 @@ func checkRootdirFs(rootdir string) error { } func getMountpoint(id string) string { - maxlen := 12 - - // we need to preserve filesystem suffix - suffix := strings.SplitN(id, "-", 2) - - if len(suffix) > 1 { - return id[:maxlen] + "-" + suffix[1] - } - - return id[:maxlen] + return id } func detachUnmount(mountpoint string) error { - // FreeBSD doesn't have an equivalent to MNT_DETACH - return unix.Unmount(mountpoint, 0) + // FreeBSD's MNT_FORCE is roughly equivalent to MNT_DETACH + return unix.Unmount(mountpoint, unix.MNT_FORCE) } diff --git a/pkg/mount/flags_freebsd.go b/pkg/mount/flags_freebsd.go index 630d313dcd..3ba99cf935 100644 --- a/pkg/mount/flags_freebsd.go +++ b/pkg/mount/flags_freebsd.go @@ -27,6 +27,8 @@ const ( // NOATIME will not update the file access time when reading from a file. NOATIME = unix.MNT_NOATIME + mntDetach = unix.MNT_FORCE + NODIRATIME = 0 NODEV = 0 DIRSYNC = 0 @@ -43,5 +45,4 @@ const ( RSHARED = 0 RELATIME = 0 STRICTATIME = 0 - mntDetach = 0 )