PERFORCE change 41865 for review
Robert Watson
rwatson at FreeBSD.org
Mon Nov 10 04:12:49 GMT 2003
http://perforce.freebsd.org/chv.cgi?CH=41865
Change 41865 by rwatson at rwatson_paprika on 2003/11/09 20:11:58
Push Giant further into mac_get_fd() and mac_set_fd(): only
Grab Giant for VFS stuff, it's not needed for file descriptors
or pipes.
Affected files ...
.. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#427 edit
Differences ...
==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#427 (text+ko) ====
@@ -740,7 +740,6 @@
}
buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- mtx_lock(&Giant); /* VFS */
error = fget(td, uap->fd, &fp);
if (error)
goto out;
@@ -751,6 +750,7 @@
case DTYPE_VNODE:
vp = fp->f_vnode;
+ 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);
@@ -758,6 +758,7 @@
error = mac_externalize_vnode_label(intlabel, elements,
buffer, mac.m_buflen);
mac_vnode_label_free(intlabel);
+ mtx_unlock(&Giant); /* VFS */
break;
case DTYPE_PIPE:
pipe = fp->f_data;
@@ -777,7 +778,6 @@
if (error == 0)
error = copyout(buffer, mac.m_string, strlen(buffer)+1);
out:
- mtx_unlock(&Giant); /* VFS */
free(buffer, M_MACTEMP);
free(elements, M_MACTEMP);
return (error);
@@ -922,8 +922,6 @@
return (error);
}
- mtx_lock(&Giant); /* VFS */
-
error = fget(td, uap->fd, &fp);
if (error)
goto out;
@@ -939,6 +937,7 @@
}
vp = fp->f_vnode;
+ mtx_lock(&Giant); /* VFS */
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
if (error != 0) {
mac_vnode_label_free(intlabel);
@@ -950,6 +949,7 @@
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
mac_vnode_label_free(intlabel);
+ mtx_unlock(&Giant); /* VFS */
break;
case DTYPE_PIPE:
@@ -968,13 +968,9 @@
default:
error = EINVAL;
}
-
fdrop(fp, td);
out:
- mtx_unlock(&Giant); /* VFS */
-
free(buffer, M_MACTEMP);
-
return (error);
}
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