From 9569e81b84ed0c26711793ca8d937e6f7e27e6b3 Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 11 Jul 2006 20:52:08 +0000 Subject: - Add conditional VFS Giant locking to getdents_common() (linux ABIs), ibcs2_getdents(), ibcs2_read(), ogetdirentries(), svr4_sys_getdents(), and svr4_sys_getdents64() similar to that in getdirentries(). - Mark ibcs2_getdents(), ibcs2_read(), linux_getdents(), linux_getdents64(), linux_readdir(), ogetdirentries(), svr4_sys_getdents(), and svr4_sys_getdents64() MPSAFE. --- sys/compat/svr4/svr4_misc.c | 11 ++++++++--- sys/compat/svr4/syscalls.master | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'sys/compat/svr4') diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index affe6eb..00abe84 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -240,7 +240,7 @@ svr4_sys_getdents64(td, uap) struct iovec aiov; off_t off; struct svr4_dirent64 svr4_dirent; - int buflen, error, eofflag, nbytes, justone; + int buflen, error, eofflag, nbytes, justone, vfslocked; u_long *cookies = NULL, *cookiep; int ncookies; @@ -256,8 +256,9 @@ svr4_sys_getdents64(td, uap) } vp = fp->f_vnode; - + vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type != VDIR) { + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); return (EINVAL); } @@ -394,6 +395,7 @@ eof: td->td_retval[0] = nbytes - resid; out: VOP_UNLOCK(vp, 0, td); + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); if (cookies) free(cookies, M_TEMP); @@ -418,7 +420,7 @@ svr4_sys_getdents(td, uap) struct iovec aiov; struct svr4_dirent idb; off_t off; /* true file offset */ - int buflen, error, eofflag; + int buflen, error, eofflag, vfslocked; u_long *cookiebuf = NULL, *cookie; int ncookies = 0, *retval = td->td_retval; @@ -434,7 +436,9 @@ svr4_sys_getdents(td, uap) } vp = fp->f_vnode; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type != VDIR) { + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); return (EINVAL); } @@ -524,6 +528,7 @@ eof: *retval = uap->nbytes - resid; out: VOP_UNLOCK(vp, 0, td); + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); if (cookiebuf) free(cookiebuf, M_TEMP); diff --git a/sys/compat/svr4/syscalls.master b/sys/compat/svr4/syscalls.master index 32a1541..344b0c2 100644 --- a/sys/compat/svr4/syscalls.master +++ b/sys/compat/svr4/syscalls.master @@ -136,7 +136,7 @@ 78 AUE_NULL UNIMPL rfsys 79 AUE_NULL MNOPROTO { int rmdir(char *path); } 80 AUE_NULL MNOPROTO { int mkdir(char *path, int mode); } -81 AUE_NULL STD { int svr4_sys_getdents(int fd, char *buf, \ +81 AUE_NULL MSTD { int svr4_sys_getdents(int fd, char *buf, \ int nbytes); } 82 AUE_NULL UNIMPL libattach 83 AUE_NULL UNIMPL libdetach @@ -325,7 +325,7 @@ 210 AUE_NULL UNIMPL signotifywait 211 AUE_NULL UNIMPL lwp_sigredirect 212 AUE_NULL UNIMPL lwp_alarm -213 AUE_NULL STD { int svr4_sys_getdents64(int fd, \ +213 AUE_NULL MSTD { int svr4_sys_getdents64(int fd, \ struct svr4_dirent64 *dp, int nbytes); } ;213 AUE_NULL UNIMPL getdents64 214 AUE_NULL MSTD { caddr_t svr4_sys_mmap64(void *addr, \ -- cgit v1.1