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/compat/svr4/svr4_misc.c | |
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/compat/svr4/svr4_misc.c')
-rw-r--r-- | sys/compat/svr4/svr4_misc.c | 11 |
1 files changed, 8 insertions, 3 deletions
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); |