PERFORCE change 100173 for review
John Baldwin
jhb at FreeBSD.org
Tue Jun 27 21:08:20 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=100173
Change 100173 by jhb at jhb_mutex on 2006/06/27 21:07:11
Add VFS Giant locking to svr4 getdents functions and mark MPSAFE.
Affected files ...
.. //depot/projects/smpng/sys/compat/svr4/svr4_misc.c#48 edit
.. //depot/projects/smpng/sys/compat/svr4/syscalls.master#16 edit
Differences ...
==== //depot/projects/smpng/sys/compat/svr4/svr4_misc.c#48 (text+ko) ====
@@ -240,7 +240,7 @@
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 @@
}
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 @@
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 @@
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 @@
}
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 @@
*retval = uap->nbytes - resid;
out:
VOP_UNLOCK(vp, 0, td);
+ VFS_UNLOCK_GIANT(vfslocked);
fdrop(fp, td);
if (cookiebuf)
free(cookiebuf, M_TEMP);
==== //depot/projects/smpng/sys/compat/svr4/syscalls.master#16 (text+ko) ====
@@ -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, \
More information about the p4-projects
mailing list