in_pcb: add in_pcbrele_rlock()
The helper that derefs and rlocks the provided inp. Returns false if inp is still usable. Reviewed by: glebius, markj Sponsored by: Nvidia networking Differential revision: https://reviews.freebsd.org/D51143
This commit is contained in:
@@ -1744,6 +1744,23 @@ in_pcbrele(struct inpcb *inp, const inp_lookup_t lock)
|
||||
in_pcbrele_rlocked(inp) : in_pcbrele_wlocked(inp));
|
||||
}
|
||||
|
||||
/*
|
||||
* Dereference and rlock inp, for which the caller must own the
|
||||
* reference. Returns true if inp no longer usable, false otherwise.
|
||||
*/
|
||||
bool
|
||||
in_pcbrele_rlock(struct inpcb *inp)
|
||||
{
|
||||
INP_RLOCK(inp);
|
||||
if (in_pcbrele_rlocked(inp))
|
||||
return (true);
|
||||
if ((inp->inp_flags & INP_FREED) != 0) {
|
||||
INP_RUNLOCK(inp);
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unconditionally schedule an inpcb to be freed by decrementing its
|
||||
* reference count, which should occur only after the inpcb has been detached
|
||||
|
||||
@@ -681,6 +681,7 @@ void in_pcbref(struct inpcb *);
|
||||
bool in_pcbrele(struct inpcb *, inp_lookup_t);
|
||||
bool in_pcbrele_rlocked(struct inpcb *);
|
||||
bool in_pcbrele_wlocked(struct inpcb *);
|
||||
bool in_pcbrele_rlock(struct inpcb *inp);
|
||||
|
||||
typedef bool inp_match_t(const struct inpcb *, void *);
|
||||
struct inpcb_iterator {
|
||||
|
||||
Reference in New Issue
Block a user