]> git.baikalelectronics.ru Git - kernel.git/commit
s390/cmm: avoid add_timer on concurrently used timer
authorVasily Gorbik <gor@linux.ibm.com>
Fri, 13 Jul 2018 06:13:13 +0000 (08:13 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 16 Jul 2018 13:45:41 +0000 (15:45 +0200)
commitbf880f3121a081bbfecc4814f0ce25cb2de22054
treed6306145ff1baaaf3c0c134006ad24116ff9f1cd
parent8c6d06b21c6154a8beeec3065ada112eda85840f
s390/cmm: avoid add_timer on concurrently used timer

cmm_set_timer could be called concurrently from cmm_thread, cmm proc
handler, upon cmm smsg receive and timer function itself. To avoid
potential race condition and hitting BUG_ON in add_timer on already
pending timer simply reuse mod_timer which is according to
documentation "the only safe way to modify the timeout" with multiple
unserialized concurrent users. mod_timer can handle both active and
inactive timers which allows to carry out minor code simplification as
well.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/mm/cmm.c