From a959f00d13e5516f21e684ca548a4f0e9abd3f8e Mon Sep 17 00:00:00 2001 From: Yong Zhang Date: Tue, 6 Apr 2010 14:35:03 -0700 Subject: [PATCH] ratelimit: fix the return value when __ratelimit() fails to acquire the lock The log of commit 5e557547bcf5423c27f8d5cbe8d9fd76b455c10a ("ratelimit: Fix/allow use in atomic contexts"), indicates that we want to suppress the callback when the trylock fails. Signed-off-by: Yong Zhang Cc: Ingo Molnar Cc: Christian Borntraeger Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/ratelimit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ratelimit.c b/lib/ratelimit.c index b4cd24ff9b297..027a03f4c56d4 100644 --- a/lib/ratelimit.c +++ b/lib/ratelimit.c @@ -40,7 +40,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func) * the entity that is holding the lock already: */ if (!spin_trylock_irqsave(&rs->lock, flags)) - return 1; + return 0; if (!rs->begin) rs->begin = jiffies; -- 2.39.5