From 8c5606ca0b601faedf27ae7e21c5f528f824327c Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Tue, 8 Dec 2020 17:21:36 +0000 Subject: FreeBSD: Fix format of vfs.zfs.arc_no_grow_shift vfs.zfs.arc_no_grow_shift has an invalid type (15) and this causes py-sysctl to format it as a bytearray when it should be an integer. "U" is not a valid format, it should be "I" and the type should match the variable type, int. We can return EINVAL if the value is set below zero. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #11318 --- module/os/freebsd/zfs/sysctl_os.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'module/os') diff --git a/module/os/freebsd/zfs/sysctl_os.c b/module/os/freebsd/zfs/sysctl_os.c index cadde9cd3..647c1463b 100644 --- a/module/os/freebsd/zfs/sysctl_os.c +++ b/module/os/freebsd/zfs/sysctl_os.c @@ -229,15 +229,14 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2c_only_size, CTLFLAG_RD, static int sysctl_vfs_zfs_arc_no_grow_shift(SYSCTL_HANDLER_ARGS) { - uint32_t val; - int err; + int err, val; val = arc_no_grow_shift; - err = sysctl_handle_32(oidp, &val, 0, req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); - if (val >= arc_shrink_shift) + if (val < 0 || val >= arc_shrink_shift) return (EINVAL); arc_no_grow_shift = val; @@ -245,8 +244,8 @@ sysctl_vfs_zfs_arc_no_grow_shift(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_vfs_zfs, OID_AUTO, arc_no_grow_shift, - CTLTYPE_U32 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof (uint32_t), - sysctl_vfs_zfs_arc_no_grow_shift, "U", + CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, NULL, sizeof (int), + sysctl_vfs_zfs_arc_no_grow_shift, "I", "log2(fraction of ARC which must be free to allow growing)"); int -- cgit v1.2.3