ratelimit: fix the return value when __ratelimit() fails to acquire the lock

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

Signed-off-by: Yong Zhang <yong.zhang@windriver.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Yong Zhang 2010-04-06 14:35:03 -07:00 коммит произвёл Linus Torvalds
Родитель bb1dc0bacb
Коммит 57119c34e5
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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;