From owner-p4-projects@FreeBSD.ORG Thu Jul 30 12:40:58 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 488551065675; Thu, 30 Jul 2009 12:40:58 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 077AA1065690 for ; Thu, 30 Jul 2009 12:40:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E9A168FC13 for ; Thu, 30 Jul 2009 12:40:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n6UCevsd047272 for ; Thu, 30 Jul 2009 12:40:57 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n6UCevrr047270 for perforce@freebsd.org; Thu, 30 Jul 2009 12:40:57 GMT (envelope-from jhb@freebsd.org) Date: Thu, 30 Jul 2009 12:40:57 GMT Message-Id: <200907301240.n6UCevrr047270@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 166783 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: Thu, 30 Jul 2009 12:40:59 -0000 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);