Date: Thu, 30 Jul 2009 12:40:57 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 166783 for review Message-ID: <200907301240.n6UCevrr047270@repoman.freebsd.org>
index | next in thread | raw e-mail
http://perforce.freebsd.org/chv.cgi?CH=166783 Change 166783 by jhb@jhb_jhbbsd on 2009/07/30 12:40:45 More vnode -> filedesc LOR fixes. Since we are reading a single mode_t, the locking here doesn't actually close any races (there are user races between threads doing mkdir() concurrent with umask(), but the kernel cannot fix those). So, remove the locking rather than moving it up to the top of the function before grabbing the vnode lock. Submitted by: kib Affected files ... .. //depot/projects/smpng/sys/kern/vfs_syscalls.c#152 edit Differences ... ==== //depot/projects/smpng/sys/kern/vfs_syscalls.c#152 (text+ko) ==== @@ -1307,10 +1307,8 @@ return (EEXIST); } else { VATTR_NULL(&vattr); - FILEDESC_SLOCK(td->td_proc->p_fd); vattr.va_mode = (mode & ALLPERMS) & ~td->td_proc->p_fd->fd_cmask; - FILEDESC_SUNLOCK(td->td_proc->p_fd); vattr.va_rdev = dev; whiteout = 0; @@ -1442,9 +1440,7 @@ } VATTR_NULL(&vattr); vattr.va_type = VFIFO; - FILEDESC_SLOCK(td->td_proc->p_fd); vattr.va_mode = (mode & ALLPERMS) & ~td->td_proc->p_fd->fd_cmask; - FILEDESC_SUNLOCK(td->td_proc->p_fd); #ifdef MAC error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd, &vattr); @@ -1705,9 +1701,7 @@ goto restart; } VATTR_NULL(&vattr); - FILEDESC_SLOCK(td->td_proc->p_fd); vattr.va_mode = ACCESSPERMS &~ td->td_proc->p_fd->fd_cmask; - FILEDESC_SUNLOCK(td->td_proc->p_fd); #ifdef MAC vattr.va_type = VLNK; error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd, @@ -3773,9 +3767,7 @@ } VATTR_NULL(&vattr); vattr.va_type = VDIR; - FILEDESC_SLOCK(td->td_proc->p_fd); vattr.va_mode = (mode & ACCESSPERMS) &~ td->td_proc->p_fd->fd_cmask; - FILEDESC_SUNLOCK(td->td_proc->p_fd); #ifdef MAC error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd, &vattr);help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907301240.n6UCevrr047270>
