Skip to content

Commit 8c5606c

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 513c196 commit 8c5606c

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
@@ -229,24 +229,23 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, l2c_only_size, CTLFLAG_RD,
229229
static int
230230
sysctl_vfs_zfs_arc_no_grow_shift(SYSCTL_HANDLER_ARGS)
231231
{
232-
uint32_t val;
233-
int err;
232+
int err, val;
234233

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

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

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

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

252251
int

0 commit comments

Comments
 (0)