Date: Wed, 26 Jan 2011 22:48:10 +0000 (UTC) From: Matthew D Fleming <mdf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r217915 - in head/sys: geom kern sys Message-ID: <201101262248.p0QMmAJN092700@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mdf Date: Wed Jan 26 22:48:09 2011 New Revision: 217915 URL: http://svn.freebsd.org/changeset/base/217915 Log: Remove the CTLFLAG_NOLOCK as it seems to be both unused and unfunctional. Wiring the user buffer has only been done explicitly since r101422. Mark the kern.disks sysctl as MPSAFE since it is and it seems to have been mis-using the NOLOCK flag. Partially break the KPI (but not the KBI) for the sysctl_req 'lock' field since this member should be private and the "REQ_LOCKED" state seems meaningless now. Modified: head/sys/geom/geom_disk.c head/sys/kern/kern_sysctl.c head/sys/sys/sysctl.h Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Wed Jan 26 21:59:59 2011 (r217914) +++ head/sys/geom/geom_disk.c Wed Jan 26 22:48:09 2011 (r217915) @@ -527,6 +527,7 @@ sysctl_disks(SYSCTL_HANDLER_ARGS) return error; } -SYSCTL_PROC(_kern, OID_AUTO, disks, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NOLOCK, 0, 0, +SYSCTL_PROC(_kern, OID_AUTO, disks, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_disks, "A", "names of available disks"); Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Wed Jan 26 21:59:59 2011 (r217914) +++ head/sys/kern/kern_sysctl.c Wed Jan 26 22:48:09 2011 (r217915) @@ -1206,7 +1206,7 @@ kernel_sysctl(struct thread *td, int *na req.oldfunc = sysctl_old_kernel; req.newfunc = sysctl_new_kernel; - req.lock = REQ_LOCKED; + req.lock = REQ_UNWIRED; SYSCTL_XLOCK(); error = sysctl_root(0, name, namelen, &req); @@ -1314,7 +1314,7 @@ sysctl_wire_old_buffer(struct sysctl_req wiredlen = (len > 0 && len < req->oldlen) ? len : req->oldlen; ret = 0; - if (req->lock == REQ_LOCKED && req->oldptr && + if (req->lock != REQ_WIRED && req->oldptr && req->oldfunc == sysctl_old_user) { if (wiredlen != 0) { ret = vslock(req->oldptr, wiredlen); @@ -1350,8 +1350,6 @@ sysctl_find_oid(int *name, u_int namelen return (ENOENT); indx++; - if (oid->oid_kind & CTLFLAG_NOLOCK) - req->lock = REQ_UNLOCKED; if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) { if (oid->oid_handler != NULL || indx == namelen) { *noid = oid; @@ -1548,7 +1546,7 @@ userland_sysctl(struct thread *td, int * req.oldfunc = sysctl_old_user; req.newfunc = sysctl_new_user; - req.lock = REQ_LOCKED; + req.lock = REQ_UNWIRED; #ifdef KTRACE if (KTRPOINT(curthread, KTR_SYSCTL)) Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Wed Jan 26 21:59:59 2011 (r217914) +++ head/sys/sys/sysctl.h Wed Jan 26 22:48:09 2011 (r217915) @@ -77,7 +77,6 @@ struct ctlname { #define CTLFLAG_RD 0x80000000 /* Allow reads of variable */ #define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */ #define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR) -#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */ #define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */ #define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */ #define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */ @@ -122,9 +121,8 @@ struct ctlname { struct sysctl_req *req /* definitions for sysctl_req 'lock' member */ -#define REQ_UNLOCKED 0 /* not locked and not wired */ -#define REQ_LOCKED 1 /* locked and not wired */ -#define REQ_WIRED 2 /* locked and wired */ +#define REQ_UNWIRED 1 +#define REQ_WIRED 2 /* definitions for sysctl_req 'flags' member */ #if defined(__amd64__) || defined(__ia64__) || defined(__powerpc64__) @@ -137,7 +135,7 @@ struct ctlname { */ struct sysctl_req { struct thread *td; /* used for access checking */ - int lock; /* locking/wiring state */ + int lock; /* wiring state */ void *oldptr; size_t oldlen; size_t oldidx;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101262248.p0QMmAJN092700>