uipc_mqueue.c (76ad42abf9d46c7a86c9e727603fe62e8b62a37b) | uipc_mqueue.c (f7496dcab0360a74bfb00cd6118f66323fffda61) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2005 David Xu <davidxu@freebsd.org> 5 * Copyright (c) 2016-2017 Robert N. M. Watson 6 * All rights reserved. 7 * 8 * Portions of this software were developed by BAE Systems, the University of --- 1550 unchanged lines hidden (view full) --- 1559 * See if this prison root is obsolete, and clean up associated queues if it is. 1560 */ 1561static int 1562mqfs_prison_remove(void *obj, void *data __unused) 1563{ 1564 const struct prison *pr = obj; 1565 struct prison *tpr; 1566 struct mqfs_node *pn, *tpn; | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2005 David Xu <davidxu@freebsd.org> 5 * Copyright (c) 2016-2017 Robert N. M. Watson 6 * All rights reserved. 7 * 8 * Portions of this software were developed by BAE Systems, the University of --- 1550 unchanged lines hidden (view full) --- 1559 * See if this prison root is obsolete, and clean up associated queues if it is. 1560 */ 1561static int 1562mqfs_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; | 1567 struct vnode *pr_root; |
1568 | 1568 |
1569 found = 0; | 1569 pr_root = pr->pr_root; 1570 if (pr->pr_parent->pr_root == pr_root) 1571 return (0); |
1570 TAILQ_FOREACH(tpr, &allprison, pr_list) { | 1572 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); | 1573 if (tpr != pr && tpr->pr_root == pr_root) 1574 return (0); |
1576 } | 1575 } |
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); | 1576 /* 1577 * No jails are rooted in this directory anymore, 1578 * so no queues should be either. 1579 */ 1580 sx_xlock(&mqfs_data.mi_lock); 1581 LIST_FOREACH_SAFE(pn, &mqfs_data.mi_root->mn_children, 1582 mn_sibling, tpn) { 1583 if (pn->mn_pr_root == pr_root) 1584 (void)do_unlink(pn, curthread->td_ucred); |
1589 } | 1585 } |
1586 sx_xunlock(&mqfs_data.mi_lock); |
|
1590 return (0); 1591} 1592 1593/* 1594 * Allocate a message queue 1595 */ 1596static struct mqueue * 1597mqueue_alloc(const struct mq_attr *attr) --- 1351 unchanged lines hidden --- | 1587 return (0); 1588} 1589 1590/* 1591 * Allocate a message queue 1592 */ 1593static struct mqueue * 1594mqueue_alloc(const struct mq_attr *attr) --- 1351 unchanged lines hidden --- |