diff options
author | jhb <jhb@FreeBSD.org> | 2006-07-11 20:52:08 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-07-11 20:52:08 +0000 |
commit | 9569e81b84ed0c26711793ca8d937e6f7e27e6b3 (patch) | |
tree | 94d4dd9191eef2b3777b8242fb56fc1d507c2645 /sys/i386 | |
parent | 05bff8fb74812f6551cd13f62046027a7d91e606 (diff) | |
download | FreeBSD-src-9569e81b84ed0c26711793ca8d937e6f7e27e6b3.zip FreeBSD-src-9569e81b84ed0c26711793ca8d937e6f7e27e6b3.tar.gz |
- 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.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/ibcs2/ibcs2_misc.c | 10 | ||||
-rw-r--r-- | sys/i386/ibcs2/syscalls.master | 4 | ||||
-rw-r--r-- | sys/i386/linux/syscalls.master | 6 |
3 files changed, 13 insertions, 7 deletions
diff --git a/sys/i386/ibcs2/ibcs2_misc.c b/sys/i386/ibcs2/ibcs2_misc.c index c875075..042505f 100644 --- a/sys/i386/ibcs2/ibcs2_misc.c +++ b/sys/i386/ibcs2/ibcs2_misc.c @@ -329,7 +329,7 @@ ibcs2_getdents(td, uap) struct iovec aiov; struct ibcs2_dirent idb; off_t off; /* true file offset */ - int buflen, error, eofflag; + int buflen, error, eofflag, vfslocked; u_long *cookies = NULL, *cookiep; int ncookies; #define BSD_DIRENT(cp) ((struct dirent *)(cp)) @@ -342,7 +342,9 @@ ibcs2_getdents(td, uap) return (EBADF); } vp = fp->f_vnode; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type != VDIR) { /* XXX vnode readdir op should do this */ + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); return (EINVAL); } @@ -459,6 +461,7 @@ eof: td->td_retval[0] = uap->nbytes - resid; out: VOP_UNLOCK(vp, 0, td); + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); if (cookies) free(cookies, M_TEMP); @@ -484,7 +487,7 @@ ibcs2_read(td, uap) char name[14]; } idb; off_t off; /* true file offset */ - int buflen, error, eofflag, size; + int buflen, error, eofflag, size, vfslocked; u_long *cookies = NULL, *cookiep; int ncookies; @@ -499,7 +502,9 @@ ibcs2_read(td, uap) return (EBADF); } vp = fp->f_vnode; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type != VDIR) { + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); return read(td, (struct read_args *)uap); } @@ -622,6 +627,7 @@ eof: td->td_retval[0] = uap->nbytes - resid; out: VOP_UNLOCK(vp, 0, td); + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); if (cookies) free(cookies, M_TEMP); diff --git a/sys/i386/ibcs2/syscalls.master b/sys/i386/ibcs2/syscalls.master index ed79cb5..fe4302e6 100644 --- a/sys/i386/ibcs2/syscalls.master +++ b/sys/i386/ibcs2/syscalls.master @@ -39,7 +39,7 @@ 1 AUE_EXIT MNOPROTO { void sys_exit(int rval); } exit \ sys_exit_args void 2 AUE_FORK MNOPROTO { int fork(void); } -3 AUE_NULL STD { int ibcs2_read(int fd, char *buf, \ +3 AUE_NULL MSTD { int ibcs2_read(int fd, char *buf, \ u_int nbytes); } 4 AUE_NULL MNOPROTO { int write(int fd, char *buf, \ u_int nbytes); } @@ -146,7 +146,7 @@ 78 AUE_NULL UNIMPL rfs_rfsys 79 AUE_RMDIR MSTD { int ibcs2_rmdir(char *path); } 80 AUE_MKDIR MSTD { int ibcs2_mkdir(char *path, int mode); } -81 AUE_GETDIRENTRIES STD { int ibcs2_getdents(int fd, char *buf, \ +81 AUE_GETDIRENTRIES MSTD { int ibcs2_getdents(int fd, char *buf, \ int nbytes); } 82 AUE_NULL UNIMPL nosys 83 AUE_NULL UNIMPL nosys diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index 6d30f68..6365f7b 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -169,7 +169,7 @@ 87 AUE_SWAPON MNOPROTO { int swapon(char *name); } 88 AUE_REBOOT MSTD { int linux_reboot(l_int magic1, \ l_int magic2, l_uint cmd, void *arg); } -89 AUE_O_GETDENTS STD { int linux_readdir(l_uint fd, \ +89 AUE_O_GETDENTS MSTD { int linux_readdir(l_uint fd, \ struct l_dirent *dent, l_uint count); } 90 AUE_MMAP MSTD { int linux_mmap(struct l_mmap_argv *ptr); } 91 AUE_MUNMAP MNOPROTO { int munmap(caddr_t addr, int len); } @@ -248,7 +248,7 @@ 140 AUE_LSEEK MSTD { int linux_llseek(l_int fd, l_ulong ohigh, \ l_ulong olow, l_loff_t *res, \ l_uint whence); } -141 AUE_O_GETDENTS STD { int linux_getdents(l_uint fd, void *dent, \ +141 AUE_O_GETDENTS MSTD { int linux_getdents(l_uint fd, void *dent, \ l_uint count); } 142 AUE_SELECT MSTD { int linux_select(l_int nfds, \ l_fd_set *readfds, l_fd_set *writefds, \ @@ -383,7 +383,7 @@ l_size_t len, u_char *vec); } 219 AUE_MADVISE MNOPROTO { int madvise(void *addr, size_t len, \ int behav); } -220 AUE_O_GETDENTS STD { int linux_getdents64(l_uint fd, \ +220 AUE_O_GETDENTS MSTD { int linux_getdents64(l_uint fd, \ void *dirent, l_uint count); } 221 AUE_FCNTL MSTD { int linux_fcntl64(l_uint fd, l_uint cmd, \ l_ulong arg); } |