Skip to content

Commit

Permalink
ratelimit: fix the return value when __ratelimit() fails to acquire t…
Browse files Browse the repository at this point in the history
…he lock

The log of commit edaac8e ("ratelimit:
Fix/allow use in atomic contexts"), indicates that we want to suppress the
callback when the trylock fails.

Signed-off-by: Yong Zhang <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Yong Zhang authored and torvalds committed Apr 7, 2010
1 parent bb1dc0b commit 57119c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ratelimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 57119c3

Please sign in to comment.