user delegation does not respect usermount
allanjude opened this issue · 2 comments
allanjude commented
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
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.