summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_acct.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-10-22 17:50:54 +0000
committerkib <kib@FreeBSD.org>2012-10-22 17:50:54 +0000
commit560aa751e0f5cfef868bdf3fab01cdbc5169ef82 (patch)
tree6e9ef0a47c5e91d26227820c50c9767e84550821 /sys/kern/kern_acct.c
parentca71b68ea40c83f641d6485e027368568f244197 (diff)
downloadFreeBSD-src-560aa751e0f5cfef868bdf3fab01cdbc5169ef82.zip
FreeBSD-src-560aa751e0f5cfef868bdf3fab01cdbc5169ef82.tar.gz
Remove the support for using non-mpsafe filesystem modules.
In particular, do not lock Giant conditionally when calling into the filesystem module, remove the VFS_LOCK_GIANT() and related macros. Stop handling buffers belonging to non-mpsafe filesystems. The VFS_VERSION is bumped to indicate the interface change which does not result in the interface signatures changes. Conducted and reviewed by: attilio Tested by: pho
Diffstat (limited to 'sys/kern/kern_acct.c')
-rw-r--r--sys/kern/kern_acct.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index fda217a..3362112 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -196,7 +196,7 @@ int
sys_acct(struct thread *td, struct acct_args *uap)
{
struct nameidata nd;
- int error, flags, vfslocked, replacing;
+ int error, flags, replacing;
error = priv_check(td, PRIV_ACCT);
if (error)
@@ -207,30 +207,26 @@ sys_acct(struct thread *td, struct acct_args *uap)
* appending and make sure it's a 'normal'.
*/
if (uap->path != NULL) {
- NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE | AUDITVNODE1,
+ NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1,
UIO_USERSPACE, uap->path, td);
flags = FWRITE | O_APPEND;
error = vn_open(&nd, &flags, 0, NULL);
if (error)
return (error);
- vfslocked = NDHASGIANT(&nd);
NDFREE(&nd, NDF_ONLY_PNBUF);
#ifdef MAC
error = mac_system_check_acct(td->td_ucred, nd.ni_vp);
if (error) {
VOP_UNLOCK(nd.ni_vp, 0);
vn_close(nd.ni_vp, flags, td->td_ucred, td);
- VFS_UNLOCK_GIANT(vfslocked);
return (error);
}
#endif
VOP_UNLOCK(nd.ni_vp, 0);
if (nd.ni_vp->v_type != VREG) {
vn_close(nd.ni_vp, flags, td->td_ucred, td);
- VFS_UNLOCK_GIANT(vfslocked);
return (EACCES);
}
- VFS_UNLOCK_GIANT(vfslocked);
#ifdef MAC
} else {
error = mac_system_check_acct(td->td_ucred, NULL);
@@ -259,11 +255,8 @@ sys_acct(struct thread *td, struct acct_args *uap)
* enabled.
*/
acct_suspended = 0;
- if (acct_vp != NULL) {
- vfslocked = VFS_LOCK_GIANT(acct_vp->v_mount);
+ if (acct_vp != NULL)
error = acct_disable(td, !replacing);
- VFS_UNLOCK_GIANT(vfslocked);
- }
if (uap->path == NULL) {
if (acct_state & ACCT_RUNNING) {
acct_state |= ACCT_EXITREQ;
@@ -291,9 +284,7 @@ sys_acct(struct thread *td, struct acct_args *uap)
error = kproc_create(acct_thread, NULL, NULL, 0, 0,
"accounting");
if (error) {
- vfslocked = VFS_LOCK_GIANT(acct_vp->v_mount);
(void) vn_close(acct_vp, acct_flags, acct_cred, td);
- VFS_UNLOCK_GIANT(vfslocked);
crfree(acct_cred);
acct_configured = 0;
acct_vp = NULL;
@@ -346,7 +337,7 @@ acct_process(struct thread *td)
struct plimit *newlim, *oldlim;
struct proc *p;
struct rusage ru;
- int t, ret, vfslocked;
+ int t, ret;
/*
* Lockless check of accounting condition before doing the hard
@@ -442,11 +433,9 @@ acct_process(struct thread *td)
/*
* Write the accounting information to the file.
*/
- vfslocked = VFS_LOCK_GIANT(acct_vp->v_mount);
ret = vn_rdwr(UIO_WRITE, acct_vp, (caddr_t)&acct, sizeof (acct),
(off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, acct_cred, NOCRED,
NULL, td);
- VFS_UNLOCK_GIANT(vfslocked);
sx_sunlock(&acct_sx);
return (ret);
}
@@ -563,7 +552,6 @@ static void
acctwatch(void)
{
struct statfs sb;
- int vfslocked;
sx_assert(&acct_sx, SX_XLOCKED);
@@ -581,10 +569,8 @@ acctwatch(void)
* If our vnode is no longer valid, tear it down and signal the
* accounting thread to die.
*/
- vfslocked = VFS_LOCK_GIANT(acct_vp->v_mount);
if (acct_vp->v_type == VBAD) {
(void) acct_disable(NULL, 1);
- VFS_UNLOCK_GIANT(vfslocked);
acct_state |= ACCT_EXITREQ;
return;
}
@@ -593,11 +579,8 @@ acctwatch(void)
* Stopping here is better than continuing, maybe it will be VBAD
* next time around.
*/
- if (VFS_STATFS(acct_vp->v_mount, &sb) < 0) {
- VFS_UNLOCK_GIANT(vfslocked);
+ if (VFS_STATFS(acct_vp->v_mount, &sb) < 0)
return;
- }
- VFS_UNLOCK_GIANT(vfslocked);
if (acct_suspended) {
if (sb.f_bavail > (int64_t)(acctresume * sb.f_blocks /
100)) {
OpenPOWER on IntegriCloud