Skip to content

Commit ae2cfdf

Browse files
Ryan Moellerbehlendorf
authored andcommitted
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 <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #11318
1 parent 20e4513 commit ae2cfdf

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

module/os/freebsd/zfs/sysctl_os.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,24 +228,23 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2c_only_size, CTLFLAG_RD,
228228
static int
229229
sysctl_vfs_zfs_arc_no_grow_shift(SYSCTL_HANDLER_ARGS)
230230
{
231-
uint32_t val;
232-
int err;
231+
int err, val;
233232

234233
val = arc_no_grow_shift;
235-
err = sysctl_handle_32(oidp, &val, 0, req);
234+
err = sysctl_handle_int(oidp, &val, 0, req);
236235
if (err != 0 || req->newptr == NULL)
237236
return (err);
238237

239-
if (val >= arc_shrink_shift)
238+
if (val < 0 || val >= arc_shrink_shift)
240239
return (EINVAL);
241240

242241
arc_no_grow_shift = val;
243242
return (0);
244243
}
245244

246245
SYSCTL_PROC(_vfs_zfs, OID_AUTO, arc_no_grow_shift,
247-
CTLTYPE_U32 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof (uint32_t),
248-
sysctl_vfs_zfs_arc_no_grow_shift, "U",
246+
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, NULL, sizeof (int),
247+
sysctl_vfs_zfs_arc_no_grow_shift, "I",
249248
"log2(fraction of ARC which must be free to allow growing)");
250249

251250
int

0 commit comments

Comments
 (0)