| 1863 | } |
| 1864 | |
| 1865 | static struct ucred * |
| 1866 | crunuse(struct thread *td) |
| 1867 | { |
| 1868 | struct ucred *cr, *crold; |
| 1869 | |
| 1870 | MPASS(td->td_realucred == td->td_ucred); |
| 1871 | cr = td->td_realucred; |
| 1872 | mtx_lock(&cr->cr_mtx); |
| 1873 | cr->cr_ref += td->td_ucredref; |
| 1874 | td->td_ucredref = 0; |
| 1875 | KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", |
| 1876 | __func__, cr->cr_users, cr)); |
| 1877 | cr->cr_users--; |
| 1878 | if (cr->cr_users == 0) { |
| 1879 | KASSERT(cr->cr_ref > 0, ("%s: ref %d not > 0 on cred %p", |
| 1880 | __func__, cr->cr_ref, cr)); |
| 1881 | crold = cr; |
| 1882 | } else { |
| 1883 | cr->cr_ref--; |
| 1884 | crold = NULL; |
| 1885 | } |
| 1886 | mtx_unlock(&cr->cr_mtx); |
| 1887 | td->td_realucred = NULL; |
| 1888 | return (crold); |
| 1889 | } |
| 1890 | |
| 1891 | static void |
| 1892 | crunusebatch(struct ucred *cr, int users, int ref) |
no test coverage detected