Skip to contentSkip to conversation

watchdog-update-watchdog-attributes-atomically.patch removed from -mm tree

merged [email protected] 1 participant 1 message Sep 25, 2013

lore
Share & tools
lore
#0 lore raw

Subject: [merged] watchdog-update-watchdog-attributes-atomically.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Wed, 25 Sep 2013 12:05:50 -0700

The patch titled
Subject: watchdog: update watchdog attributes atomically
has been removed from the -mm tree. Its filename was
watchdog-update-watchdog-attributes-atomically.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Michal Hocko <[email protected]>
Subject: watchdog: update watchdog attributes atomically

proc_dowatchdog doesn't synchronize multiple callers which might lead to confusion when two parallel callers might confuse watchdog_enable_all_cpus resp. watchdog_disable_all_cpus (e.g. watchdog gets enabled even if watchdog_thresh was set to 0 already).

This patch adds a local mutex which synchronizes callers to the sysctl handler.

---

 kernel/watchdog.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/watchdog.c renamed from kernel/watchdog.c~watchdog-update-watchdog-attributes-atomically +3 -1
diff -puN kernel/watchdog.c~watchdog-update-watchdog-attributes-atomically kernel/watchdog.c
@@ -520,13 +520,15 @@ int proc_dowatchdog(struct ctl_table *ta
 		    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	int err, old_thresh, old_enabled;
+	static DEFINE_MUTEX(watchdog_proc_mutex);
 
+	mutex_lock(&watchdog_proc_mutex);
 	old_thresh = ACCESS_ONCE(watchdog_thresh);
 	old_enabled = ACCESS_ONCE(watchdog_user_enabled);
 
 	err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
 	if (err || !write)
-		return err;
+		goto out;
 
 	set_sample_period();
 	/*
@@ -544,7 +546,8 @@ int proc_dowatchdog(struct ctl_table *ta
 		watchdog_thresh = old_thresh;
 		watchdog_user_enabled = old_enabled;
 	}