From 844237b3960bfbf49070d6371a84f67f9e3366f6 Mon Sep 17 00:00:00 2001 From: alfred Date: Sun, 13 Jan 2002 11:58:06 +0000 Subject: SMP Lock struct file, filedesc and the global file list. Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file * ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file * ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe the fget cruft, I'll get to that asap. --- sys/kern/kern_acl.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys/kern/kern_acl.c') diff --git a/sys/kern/kern_acl.c b/sys/kern/kern_acl.c index b50c896..63be63d 100644 --- a/sys/kern/kern_acl.c +++ b/sys/kern/kern_acl.c @@ -703,6 +703,7 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap) if (error == 0) { error = vacl_get_acl(td, (struct vnode *)fp->f_data, SCARG(uap, type), SCARG(uap, aclp)); + fdrop(fp, td); } mtx_unlock(&Giant); return (error); @@ -724,6 +725,7 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap) if (error == 0) { error = vacl_set_acl(td, (struct vnode *)fp->f_data, SCARG(uap, type), SCARG(uap, aclp)); + fdrop(fp, td); } mtx_unlock(&Giant); return (error); @@ -767,6 +769,7 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap) if (error == 0) { error = vacl_delete(td, (struct vnode *)fp->f_data, SCARG(uap, type)); + fdrop(fp, td); } mtx_unlock(&Giant); return (error); @@ -811,6 +814,7 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap) if (error == 0) { error = vacl_aclcheck(td, (struct vnode *)fp->f_data, SCARG(uap, type), SCARG(uap, aclp)); + fdrop(fp, td); } mtx_unlock(&Giant); return (error); -- cgit v1.1