Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146151139
D28639.1779344977.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
795 B
Referenced Files
None
Subscribers
None
D28639.1779344977.diff
View Options
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1857,8 +1857,18 @@
void
ifa_ref(struct ifaddr *ifa)
{
+ u_int old;
- refcount_acquire(&ifa->ifa_refcnt);
+ old = refcount_acquire(&ifa->ifa_refcnt);
+ KASSERT(old > 0, ("%s: ifa %p has 0 refs", __func__, ifa));
+}
+
+int
+ifa_try_ref(struct ifaddr *ifa)
+{
+
+ NET_EPOCH_ASSERT();
+ return (refcount_acquire_if_not_zero(&ifa->ifa_refcnt));
}
static void
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -577,6 +577,7 @@
struct ifaddr * ifa_alloc(size_t size, int flags);
void ifa_free(struct ifaddr *ifa);
void ifa_ref(struct ifaddr *ifa);
+int ifa_try_ref(struct ifaddr *ifa);
/*
* Multicast address structure. This is analogous to the ifaddr
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 21, 6:29 AM (6 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28756134
Default Alt Text
D28639.1779344977.diff (795 B)
Attached To
Mode
D28639: Add ifa_try_ref() to simplify ifa handling inside epoch.
Attached
Detach File
Event Timeline
Log In to Comment