aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryouzhongyang <[email protected]>2022-09-20 18:25:21 -0400
committerGitHub <[email protected]>2022-09-20 15:25:21 -0700
commit62e2a2881f6b441c136fb4ccb66ab491a5e6101f (patch)
treec242b38c834edbe4b67f9a187d837d2558bba2cb
parentfbf874a4acd86a118a695fb695fe934e68fc6b6f (diff)
Fix minor issues in namespace delegation support
get_user_ns() is only done once for each namespace, so put_user_ns() should be done once too. Fix two typos in user_namespace/user_namespace_002.ksh and user_namespace/user_namespace_003.ksh. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Youzhong Yang <[email protected]> Closes #13918
-rw-r--r--module/os/linux/spl/spl-zone.c2
-rwxr-xr-xtests/zfs-tests/tests/functional/user_namespace/user_namespace_002.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/user_namespace/user_namespace_003.ksh2
3 files changed, 3 insertions, 3 deletions
diff --git a/module/os/linux/spl/spl-zone.c b/module/os/linux/spl/spl-zone.c
index b8a8b7cd8..234ae7f6c 100644
--- a/module/os/linux/spl/spl-zone.c
+++ b/module/os/linux/spl/spl-zone.c
@@ -415,8 +415,8 @@ spl_zone_fini(void)
zone_dataset_t, zd_list);
list_del(&zd->zd_list);
kmem_free(zd, sizeof (*zd) + zd->zd_dsnamelen + 1);
- put_user_ns(zds->zds_userns);
}
+ put_user_ns(zds->zds_userns);
list_del(&zds->zds_list);
kmem_free(zds, sizeof (*zds));
}
diff --git a/tests/zfs-tests/tests/functional/user_namespace/user_namespace_002.ksh b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_002.ksh
index b04898fa8..cfc478cd3 100755
--- a/tests/zfs-tests/tests/functional/user_namespace/user_namespace_002.ksh
+++ b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_002.ksh
@@ -85,7 +85,7 @@ fi
list="$($NSENTER zfs list -r -H -o name | tr '\n' ' ')"
log_must test -z "$list"
log_must zfs zone $proc_ns $TESTPOOL/userns
-proc_ns_added="$ns"
+proc_ns_added="$proc_ns"
# 2. 'zfs list'
list="$($NSENTER zfs list -r -H -o name $TESTPOOL | tr '\n' ' ')"
diff --git a/tests/zfs-tests/tests/functional/user_namespace/user_namespace_003.ksh b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_003.ksh
index 2a875d09b..6a746c6d3 100755
--- a/tests/zfs-tests/tests/functional/user_namespace/user_namespace_003.ksh
+++ b/tests/zfs-tests/tests/functional/user_namespace/user_namespace_003.ksh
@@ -88,7 +88,7 @@ list="$($NSENTER zfs list -r -H -o name | tr '\n' ' ')"
log_must test -z "$list"
log_must zfs zone $proc_ns $TESTPOOL/userns
log_must zfs zone $proc_ns $TESTPOOL/otheruserns
-proc_ns_added="$ns"
+proc_ns_added="$proc_ns"
# 2. 'zfs list'
list="$($NSENTER zfs list -r -H -o name $TESTPOOL | tr '\n' ' ')"