Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
some debugging from Eric Dumazet
Browse files Browse the repository at this point in the history
should drop a BUG_ON if refcount goes weird.
  • Loading branch information
dormando committed Jul 31, 2014
1 parent 13339c1 commit 4b47b3c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/net/dst.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,14 @@ dst_metric_locked(const struct dst_entry *dst, int metric)

static inline void dst_hold(struct dst_entry *dst)
{
int newrefcnt;
/*
* If your kernel compilation stops here, please check
* __pad_to_align_refcnt declaration in struct dst_entry
*/
BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
atomic_inc(&dst->__refcnt);
newrefcnt = atomic_inc_return(&dst->__refcnt);
BUG_ON(newrefcnt <= 1 && (dst->flags & DST_NOCACHE));
}

static inline void dst_use(struct dst_entry *dst, unsigned long time)
Expand All @@ -258,7 +260,7 @@ static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
static inline struct dst_entry *dst_clone(struct dst_entry *dst)
{
if (dst)
atomic_inc(&dst->__refcnt);
dst_hold(dst);
return dst;
}

Expand Down

0 comments on commit 4b47b3c

Please sign in to comment.