Skip to content

Strange behaviour of canmount=off #8833

Closed
@SoongNoonien

Description

@SoongNoonien

System information

Type Version/Name
Distribution Name Gentoo
Distribution Version Gentoo Base System release 2.6
Linux Kernel 5.1.5-gentoo
Architecture amd64
ZFS Version 0.8.0-r0-gentoo
SPL Version 0.8.0-r0-gentoo

Describe the problem you're observing

I'm using the canmount=off property to make children of different pools appear in the same directory as described in the man page. Unfortunately, this seems to be kind of broken since 0.8.0. I've isolated the problem to this list of commands:

/tmp # truncate -s 1G test0.img
/tmp # truncate -s 1G test1.img
/tmp # zpool create test0 /tmp/test0.img
/tmp # zpool create test1 /tmp/test1.img
/tmp # zfs create test0/a
/tmp # zfs create test1/b
/tmp # zfs set mountpoint=none test0
/tmp # zfs set mountpoint=/a test0/a
/tmp # zfs set canmount=off test1
/tmp # zfs set mountpoint=/a test1
/tmp # zfs list -o name,mounted,canmount,mountpoint
NAME     MOUNTED  CANMOUNT  MOUNTPOINT
test0         no        on  none
test0/a      yes        on  /a
test1         no       off  /a
test1/b      yes        on  /a/b
/tmp # zfs unmount -a
/tmp # zfs mount -a
/tmp # zfs unmount -a
/tmp # zfs mount -a
cannot mount '/a': directory is not empty
/tmp #

Apparently zfs mount -a isn't able to resolve the mountpoints anymore. I found two different workarounds for this issue.
One can simply avoid using canmount to inherit mountpoints by setting the mountpoints manually. For this example zfs set mountpoint=none test1 and zfs set mountpoint=/a/b test1/b.
The stranger solution is swapping the names of the pools. Or simply choose any new name for test0 to make it appear after test1 in zfs list. (e.g. test2) So the name order of the pools seems to have an impact on the disentanglement of mountpoints.
I was able to reproduce the issue on Gentoo and Arch but not on Openindiana.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DefectIncorrect behavior (e.g. crash, hang)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions