Unverified Commit 945c3f08 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!12639 net: do not delay dst_entries_add() in dst_release()

parents ffc5791c c70b978c
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -109,9 +109,6 @@ struct dst_entry *dst_destroy(struct dst_entry * dst)
		child = xdst->child;
	}
#endif
	if (!(dst->flags & DST_NOCOUNT))
		dst_entries_add(dst->ops, -1);

	if (dst->ops->destroy)
		dst->ops->destroy(dst);
	if (dst->dev)
@@ -162,6 +159,12 @@ void dst_dev_put(struct dst_entry *dst)
}
EXPORT_SYMBOL(dst_dev_put);

static void dst_count_dec(struct dst_entry *dst)
{
	if (!(dst->flags & DST_NOCOUNT))
		dst_entries_add(dst->ops, -1);
}

void dst_release(struct dst_entry *dst)
{
	if (dst) {
@@ -171,10 +174,12 @@ void dst_release(struct dst_entry *dst)
		if (WARN_ONCE(newrefcnt < 0, "dst_release underflow"))
			net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
					     __func__, dst, newrefcnt);
		if (!newrefcnt)
		if (!newrefcnt) {
			dst_count_dec(dst);
			call_rcu(&dst->rcu_head, dst_destroy_rcu);
		}
	}
}
EXPORT_SYMBOL(dst_release);

void dst_release_immediate(struct dst_entry *dst)
@@ -186,10 +191,12 @@ void dst_release_immediate(struct dst_entry *dst)
		if (WARN_ONCE(newrefcnt < 0, "dst_release_immediate underflow"))
			net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
					     __func__, dst, newrefcnt);
		if (!newrefcnt)
		if (!newrefcnt) {
			dst_count_dec(dst);
			dst_destroy(dst);
		}
	}
}
EXPORT_SYMBOL(dst_release_immediate);

u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old)