From owner-p4-projects@FreeBSD.ORG Fri Jun 23 18:49:00 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D4EAA16A4C8; Fri, 23 Jun 2006 18:48:59 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 91AA816A4C2 for ; Fri, 23 Jun 2006 18:48:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47F7643D4C for ; Fri, 23 Jun 2006 18:48:59 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5NImx46041824 for ; Fri, 23 Jun 2006 18:48:59 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5NImwob041821 for perforce@freebsd.org; Fri, 23 Jun 2006 18:48:58 GMT (envelope-from jhb@freebsd.org) Date: Fri, 23 Jun 2006 18:48:58 GMT Message-Id: <200606231848.k5NImwob041821@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 99884 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jun 2006 18:49:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=99884 Change 99884 by jhb@jhb_mutex on 2006/06/23 18:48:41 - Add VFS Giant locking to the Linux ABI's getdents_common() function. - The linux mount(2) and getdents(2) families are MPSAFE. Affected files ... .. //depot/projects/smpng/sys/amd64/linux32/syscalls.master#9 edit .. //depot/projects/smpng/sys/compat/linux/linux_file.c#29 edit .. //depot/projects/smpng/sys/i386/linux/syscalls.master#27 edit Differences ... ==== //depot/projects/smpng/sys/amd64/linux32/syscalls.master#9 (text+ko) ==== @@ -75,10 +75,10 @@ 19 AUE_LSEEK MSTD { int linux_lseek(l_uint fdes, l_off_t off, \ l_int whence); } 20 AUE_GETPID MSTD { int linux_getpid(void); } -21 AUE_MOUNT STD { int linux_mount(char *specialfile, \ +21 AUE_MOUNT MSTD { int linux_mount(char *specialfile, \ char *dir, char *filesystemtype, \ l_ulong rwflag, void *data); } -22 AUE_UMOUNT STD { int linux_oldumount(char *path); } +22 AUE_UMOUNT MSTD { int linux_oldumount(char *path); } 23 AUE_SETUID MSTD { int linux_setuid16(l_uid16_t uid); } 24 AUE_GETUID MSTD { int linux_getuid16(void); } 25 AUE_SETTIMEOFDAY MSTD { int linux_stime(void); } @@ -111,7 +111,7 @@ 49 AUE_GETEUID MSTD { int linux_geteuid16(void); } 50 AUE_GETEGID MSTD { int linux_getegid16(void); } 51 AUE_ACCT MNOPROTO { int acct(char *path); } -52 AUE_UMOUNT STD { int linux_umount(char *path, l_int flags); } +52 AUE_UMOUNT MSTD { int linux_umount(char *path, l_int flags); } 53 AUE_NULL UNIMPL lock 54 AUE_IOCTL STD { int linux_ioctl(l_uint fd, l_uint cmd, \ uintptr_t arg); } @@ -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); } @@ -246,7 +246,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, \ @@ -381,7 +381,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, \ uintptr_t arg); } ==== //depot/projects/smpng/sys/compat/linux/linux_file.c#29 (text+ko) ==== @@ -259,7 +259,7 @@ struct l_dirent64 linux_dirent64; int buflen, error, eofflag, nbytes, justone; u_long *cookies = NULL, *cookiep; - int ncookies; + int ncookies, vfslocked; if ((error = getvnode(td->td_proc->p_fd, args->fd, &fp)) != 0) return (error); @@ -270,7 +270,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); } @@ -279,6 +281,7 @@ if (nbytes == 1) { /* readdir(2) case. Always struct dirent. */ if (is64bit) { + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); return (EINVAL); } @@ -439,6 +442,7 @@ free(cookies, M_TEMP); VOP_UNLOCK(vp, 0, td); + VFS_UNLOCK_GIANT(vfslocked); fdrop(fp, td); free(buf, M_TEMP); return (error); ==== //depot/projects/smpng/sys/i386/linux/syscalls.master#27 (text+ko) ==== @@ -74,10 +74,10 @@ 19 AUE_LSEEK MSTD { int linux_lseek(l_uint fdes, l_off_t off, \ l_int whence); } 20 AUE_GETPID MSTD { int linux_getpid(void); } -21 AUE_MOUNT STD { int linux_mount(char *specialfile, \ +21 AUE_MOUNT MSTD { int linux_mount(char *specialfile, \ char *dir, char *filesystemtype, \ l_ulong rwflag, void *data); } -22 AUE_UMOUNT STD { int linux_oldumount(char *path); } +22 AUE_UMOUNT MSTD { int linux_oldumount(char *path); } 23 AUE_SETUID MSTD { int linux_setuid16(l_uid16_t uid); } 24 AUE_GETUID MSTD { int linux_getuid16(void); } 25 AUE_SETTIMEOFDAY MSTD { int linux_stime(void); } @@ -111,7 +111,7 @@ 49 AUE_GETEUID MSTD { int linux_geteuid16(void); } 50 AUE_GETEGID MSTD { int linux_getegid16(void); } 51 AUE_ACCT MNOPROTO { int acct(char *path); } -52 AUE_UMOUNT STD { int linux_umount(char *path, l_int flags); } +52 AUE_UMOUNT MSTD { int linux_umount(char *path, l_int flags); } 53 AUE_NULL UNIMPL lock 54 AUE_IOCTL STD { int linux_ioctl(l_uint fd, l_uint cmd, \ l_ulong arg); } @@ -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); }