Changeset View
Changeset View
Standalone View
Standalone View
kern/uipc_mqueue_28419.c
Show First 20 Lines • Show All 1,558 Lines • ▼ Show 20 Lines | |||||
* See if this prison root is obsolete, and clean up associated queues if it is. | * See if this prison root is obsolete, and clean up associated queues if it is. | ||||
*/ | */ | ||||
static int | static int | ||||
mqfs_prison_remove(void *obj, void *data __unused) | mqfs_prison_remove(void *obj, void *data __unused) | ||||
{ | { | ||||
const struct prison *pr = obj; | const struct prison *pr = obj; | ||||
struct prison *tpr; | struct prison *tpr; | ||||
struct mqfs_node *pn, *tpn; | struct mqfs_node *pn, *tpn; | ||||
int found; | struct vnode *pr_root; | ||||
found = 0; | pr_root = pr->pr_root; | ||||
if (pr->pr_parent->pr_root == pr_root) | |||||
return (0); | |||||
TAILQ_FOREACH(tpr, &allprison, pr_list) { | TAILQ_FOREACH(tpr, &allprison, pr_list) { | ||||
prison_lock(tpr); | |||||
if (tpr != pr && prison_isvalid(tpr) && | if (tpr != pr && prison_isvalid(tpr) && | ||||
tpr->pr_root == pr->pr_root) | tpr->pr_root == pr_root) | ||||
found = 1; | return (0); | ||||
prison_unlock(tpr); | |||||
} | } | ||||
if (!found) { | |||||
/* | /* | ||||
* No jails are rooted in this directory anymore, | * No jails are rooted in this directory anymore, | ||||
* so no queues should be either. | * so no queues should be either. | ||||
*/ | */ | ||||
sx_xlock(&mqfs_data.mi_lock); | sx_xlock(&mqfs_data.mi_lock); | ||||
LIST_FOREACH_SAFE(pn, &mqfs_data.mi_root->mn_children, | LIST_FOREACH_SAFE(pn, &mqfs_data.mi_root->mn_children, | ||||
mn_sibling, tpn) { | mn_sibling, tpn) { | ||||
if (pn->mn_pr_root == pr->pr_root) | if (pn->mn_pr_root == pr_root) | ||||
(void)do_unlink(pn, curthread->td_ucred); | (void)do_unlink(pn, curthread->td_ucred); | ||||
} | } | ||||
sx_xunlock(&mqfs_data.mi_lock); | sx_xunlock(&mqfs_data.mi_lock); | ||||
} | |||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Allocate a message queue | * Allocate a message queue | ||||
*/ | */ | ||||
static struct mqueue * | static struct mqueue * | ||||
mqueue_alloc(const struct mq_attr *attr) | mqueue_alloc(const struct mq_attr *attr) | ||||
▲ Show 20 Lines • Show All 1,351 Lines • Show Last 20 Lines |