* See if this prison root is obsolete, and clean up associated queues if it is. */
| 1559 | * See if this prison root is obsolete, and clean up associated queues if it is. |
| 1560 | */ |
| 1561 | static int |
| 1562 | mqfs_prison_remove(void *obj, void *data __unused) |
| 1563 | { |
| 1564 | const struct prison *pr = obj; |
| 1565 | struct prison *tpr; |
| 1566 | struct mqfs_node *pn, *tpn; |
| 1567 | int found; |
| 1568 | |
| 1569 | found = 0; |
| 1570 | TAILQ_FOREACH(tpr, &allprison, pr_list) { |
| 1571 | prison_lock(tpr); |
| 1572 | if (tpr != pr && prison_isvalid(tpr) && |
| 1573 | tpr->pr_root == pr->pr_root) |
| 1574 | found = 1; |
| 1575 | prison_unlock(tpr); |
| 1576 | } |
| 1577 | if (!found) { |
| 1578 | /* |
| 1579 | * No jails are rooted in this directory anymore, |
| 1580 | * so no queues should be either. |
| 1581 | */ |
| 1582 | sx_xlock(&mqfs_data.mi_lock); |
| 1583 | LIST_FOREACH_SAFE(pn, &mqfs_data.mi_root->mn_children, |
| 1584 | mn_sibling, tpn) { |
| 1585 | if (pn->mn_pr_root == pr->pr_root) |
| 1586 | (void)do_unlink(pn, curthread->td_ucred); |
| 1587 | } |
| 1588 | sx_xunlock(&mqfs_data.mi_lock); |
| 1589 | } |
| 1590 | return (0); |
| 1591 | } |
| 1592 | |
| 1593 | /* |
| 1594 | * Allocate a message queue |
nothing calls this directly
no test coverage detected