PERFORCE change 166783 for review

John Baldwin jhb at FreeBSD.org
Thu Jul 30 12:40:59 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=166783

Change 166783 by jhb at 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);


More information about the p4-projects mailing list