]> git.baikalelectronics.ru Git - kernel.git/commit
watchdog: Add Locking support
authorHans de Goede <hdegoede@redhat.com>
Tue, 22 May 2012 09:40:26 +0000 (11:40 +0200)
committerWim Van Sebroeck <wim@iguana.be>
Wed, 30 May 2012 05:55:23 +0000 (07:55 +0200)
commit4e169d4bfc5c0c08cbf51d5721b1a7b6bf2149d9
tree82d688ae7782234dc01c6a340596bac21531aae4
parent7f59bf17db2680f96fb4654b7057dea66ceb3ef2
watchdog: Add Locking support

This patch fixes some potential multithreading issues, despite only
allowing one process to open the /dev/watchdog device, we can still get
called multiple times at the same time, since a program could be using thread,
or could share the fd after a fork.

This causes 2 potential problems:
1) watchdog_start / open do an unlocked test_n_set / test_n_clear,
   if these 2 race, the watchdog could be stopped while the active
   bit indicates it is running or visa versa.

2) Most watchdog_dev drivers probably assume that only one
   watchdog-op will get called at a time, this is not necessary
   true atm.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Documentation/watchdog/watchdog-kernel-api.txt
drivers/watchdog/watchdog_core.c
drivers/watchdog/watchdog_dev.c
include/linux/watchdog.h