zfsonfreebsd / ZoF

ZFS on FreeBSD - the official out of tree OpenZFS implementation for FreeBSD
https://freebsd.org
Other
100 stars 8 forks source link

user delegation does not respect usermount #99

Closed allanjude closed 5 years ago

allanjude commented 5 years ago

System information

FreeBSD stable/12 (ZoF CFT image 20190418)

Describe the problem you're observing

When a dataset is delegated to a user, and a child is created, an incorrect error message is displayed.

Describe how to reproduce the problem

# sysctl vfs.usermount=1
# zfs create testpool/userdelegation
# chown allan:allan /testpool/userdelegation
# zfs allow -u allan create,destroy,mount,snapshot testpool/userdelegation
# su allan
% zfs create testpool/userdelegation/new
filesystem successfully created, but it may only be mounted by root
% zfs get mounted testpool/userdelegation/new
NAME                         PROPERTY  VALUE    SOURCE
testpool/userdelegation/new  mounted   no       -

I assume this message is because ZoL doesn't have something like vfs.usermount. If usermount is not enabled, this is still the correct error message, but if it IS enabled, it should be mounted, like it is today on FreeBSD.

Mounting as a regular user does work (with the vfs.usermount proviso that the user own the directory that are mounting the filesystem to)

% zfs mount testpool/userdelegation/new
% zfs get mounted testpool/userdelegation/new
NAME                         PROPERTY  VALUE    SOURCE
testpool/userdelegation/new  mounted   yes      -
mattmacy commented 5 years ago

The zfs create command itself is checking in userspace and forbidding it - which strikes me as useless apart from perhaps giving a better error message on Linux.

mattmacy commented 5 years ago

fixed by 4cf25917fb5ef2aef46121960924352594d3ca48