Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Nov 2003 14:12:00 -0800 (PST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 42170 for review
Message-ID:  <200311122212.hACMC0LO026235@repoman.freebsd.org>

index | next in thread | raw e-mail

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

Change 42170 by rwatson@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:


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311122212.hACMC0LO026235>