PERFORCE change 42170 for review

Robert Watson rwatson at FreeBSD.org
Wed Nov 12 22:12:00 GMT 2003


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

Change 42170 by rwatson at rwatson_tislabs on 2003/11/12 14:11:05

	Slide MAC label allocations outside of Giant in system calls
	touching VFS.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#431 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#431 (text+ko) ====

@@ -752,15 +752,15 @@
 	case DTYPE_VNODE:
 		vp = fp->f_vnode;
 
+		intlabel = mac_vnode_label_alloc();
 		mtx_lock(&Giant);				/* VFS */
-		intlabel = mac_vnode_label_alloc();
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
 		mac_copy_vnode_label(vp->v_label, intlabel);
 		VOP_UNLOCK(vp, 0, td);
 		error = mac_externalize_vnode_label(intlabel, elements,
 		    buffer, mac.m_buflen);
+		mtx_unlock(&Giant);				/* VFS */
 		mac_vnode_label_free(intlabel);
-		mtx_unlock(&Giant);				/* VFS */
 		break;
 	case DTYPE_PIPE:
 		pipe = fp->f_data;
@@ -951,8 +951,8 @@
 		error = vn_setlabel(vp, intlabel, td->td_ucred);
 		VOP_UNLOCK(vp, 0, td);
 		vn_finished_write(mp);
+		mtx_unlock(&Giant);				/* VFS */
 		mac_vnode_label_free(intlabel);
-		mtx_unlock(&Giant);				/* VFS */
 		break;
 
 	case DTYPE_PIPE:
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list