svn commit: r192232 - in user/kmacy/ZFS_MFC/sys:
cddl/compat/opensolaris/kern sys
Kip Macy
kmacy at FreeBSD.org
Sat May 16 22:54:17 UTC 2009
Author: kmacy
Date: Sat May 16 22:54:16 2009
New Revision: 192232
URL: http://svn.freebsd.org/changeset/base/192232
Log:
restore osd support to prisons
Modified:
user/kmacy/ZFS_MFC/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c
user/kmacy/ZFS_MFC/sys/sys/jail.h
Modified: user/kmacy/ZFS_MFC/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c
==============================================================================
--- user/kmacy/ZFS_MFC/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c Sat May 16 22:31:38 2009 (r192231)
+++ user/kmacy/ZFS_MFC/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c Sat May 16 22:54:16 2009 (r192232)
@@ -33,11 +33,11 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
-#include <sys/osd.h>
#include <sys/sx.h>
#include <sys/malloc.h>
#include <sys/queue.h>
#include <sys/jail.h>
+#include <sys/osd.h>
#include <sys/priv.h>
#include <sys/zone.h>
@@ -76,11 +76,8 @@ zone_dataset_attach(struct ucred *cred,
free(zd, M_ZONES);
return (ENOENT);
}
-#if 0
+
head = osd_jail_get(pr, zone_slot);
-#else
- head = NULL;
-#endif
if (head != NULL) {
dofree = 0;
LIST_FOREACH(zd2, head, zd_next) {
@@ -97,6 +94,8 @@ zone_dataset_attach(struct ucred *cred,
head = malloc(sizeof(*head), M_ZONES, M_WAITOK);
LIST_INIT(head);
mtx_lock(&pr->pr_mtx);
+ error = osd_jail_set(pr, zone_slot, head);
+ KASSERT(error == 0, ("osd_jail_set() failed (error=%d)", error));
}
strcpy(zd->zd_dataset, dataset);
LIST_INSERT_HEAD(head, zd, zd_next);
@@ -124,6 +123,11 @@ zone_dataset_detach(struct ucred *cred,
sx_sunlock(&allprison_lock);
if (pr == NULL)
return (ENOENT);
+ head = osd_jail_get(pr, zone_slot);
+ if (head == NULL) {
+ error = ENOENT;
+ goto end;
+ }
LIST_FOREACH(zd, head, zd_next) {
if (strcmp(dataset, zd->zd_dataset) == 0)
break;
@@ -133,6 +137,8 @@ zone_dataset_detach(struct ucred *cred,
else {
LIST_REMOVE(zd, zd_next);
free(zd, M_ZONES);
+ if (LIST_EMPTY(head))
+ osd_jail_del(pr, zone_slot);
error = 0;
}
end:
@@ -162,7 +168,7 @@ zone_dataset_visible(const char *dataset
}
pr = curthread->td_ucred->cr_prison;
mtx_lock(&pr->pr_mtx);
- head = NULL;
+ head = osd_jail_get(pr, zone_slot);
if (head == NULL)
goto end;
@@ -227,12 +233,14 @@ static void
zone_sysinit(void *arg __unused)
{
+ zone_slot = osd_jail_register(zone_destroy, NULL);
}
static void
zone_sysuninit(void *arg __unused)
{
+ osd_jail_deregister(zone_slot);
}
SYSINIT(zone_sysinit, SI_SUB_DRIVERS, SI_ORDER_ANY, zone_sysinit, NULL);
Modified: user/kmacy/ZFS_MFC/sys/sys/jail.h
==============================================================================
--- user/kmacy/ZFS_MFC/sys/sys/jail.h Sat May 16 22:31:38 2009 (r192231)
+++ user/kmacy/ZFS_MFC/sys/sys/jail.h Sat May 16 22:54:16 2009 (r192232)
@@ -14,6 +14,8 @@
#define _SYS_JAIL_H_
#ifdef _KERNEL
+#include <sys/osd.h>
+
struct jail_v0 {
u_int32_t version;
char *path;
@@ -137,6 +139,7 @@ struct prison {
struct in_addr *pr_ip4; /* (c) v4 IPs of jail */
int pr_ip6s; /* (c) number of v6 IPs */
struct in6_addr *pr_ip6; /* (c) v6 IPs of jail */
+ struct osd pr_osd;
};
#endif /* _KERNEL || _WANT_PRISON */
More information about the svn-src-user
mailing list