Regression in 2.2.0 when creating fs with sharesmb=off
and kernel was built with CONFIG_USER_NS=n
#15419
Labels
Type: Defect
Incorrect behavior (e.g. crash, hang)
Type: Regression
Indicates a functional regression
System information
Describe the problem you're observing
Using
zpool create ... -O sharesmb=off -O sharenfs=off ...
fails now with 2.2.0 with an error saying:despite not having even set
zoned
in myzpool create
command. I don't have a complicated setup -- I'm not using zones, namespaces, or even multiple datasets, just a single "global" zfs.After some digging into what causes this error message, it seems zfs thinks I'm trying to create a filesystem in a non-global zone (even when trying again and explicitly passing
-O zoned=off
to myzpool create
).I then found in the original PR that added this zone support that it's implicitly requiring
CONFIG_USER_NS
to be enabled in the kernel. If it's not enabled, thengetzoneid()
will return0
. When the callers of this function then compare the result to theGLOBAL_ZONEID
, which is a non-zero value, it will always assume we're not dealing with the global zone, which then causes the aforementioned error.It seems like the easy fix (although perhaps not robust as I'm not familiar with namespaces) would be to check if
/proc/self/ns/user
exists and if it doesn't, just returnGLOBAL_ZONEID
. Perhaps it may be enough to tweak the existing code such that ifreadlink() < 0
, check forerrno == ENOENT
and in that case returnGLOBAL_ZONEID
.Describe how to reproduce the problem
Try to create a zpool with
-O sharesmb=off -O sharenfs=off
with zfs 2.2.0.Include any warning/errors/backtraces from the system logs
The text was updated successfully, but these errors were encountered: