From: Chuck Ebbert <76306.1226@compuserve.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Michael Schierl <schierlm@gmx.de>,
linux-kernel <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] softdog.c (was: Kernel panic after rmmod softdog (2.6.8.1))
Date: Wed, 13 Oct 2004 19:55:39 -0400 [thread overview]
Message-ID: <200410131959_MC3-1-8C24-188B@compuserve.com> (raw)
Arnd Bergmann wrote:
> Now if you do open(), close(), open(), write("V"), close(), the module
> becomes unremovable, even without nowayout=1. Isn't is possible to
> simply add a softdog_stop() call to watchdog_exit()?
Oh well, at least it can't possibly oops since you can't even remove it. :)
How about this instead?
(Assuming a re-open of the softdog device is allowable; I don't see why not.)
--- linux-2.6.8.1/drivers/char/watchdog/softdog.c.orig Sun Oct 10 23:08:24 2004
+++ linux-2.6.8.1/drivers/char/watchdog/softdog.c Wed Oct 13 14:48:20 2004
@@ -82,9 +82,12 @@
static struct timer_list watchdog_ticktock =
TIMER_INITIALIZER(watchdog_fire, 0, 0);
-static unsigned long timer_alive;
static char expect_close;
+static unsigned long driver_status;
+/* Driver status bits */
+#define SOFTDOG_TIMER_RUNNING 0
+#define SOFTDOG_DEVICE_OPEN 1
/*
* If the timer expires..
@@ -133,9 +136,10 @@
static int softdog_open(struct inode *inode, struct file *file)
{
- if(test_and_set_bit(0, &timer_alive))
+ if (test_and_set_bit(SOFTDOG_DEVICE_OPEN, &driver_status))
return -EBUSY;
- if (nowayout)
+
+ if ( !test_and_set_bit(SOFTDOG_TIMER_RUNNING, &driver_status))
__module_get(THIS_MODULE);
/*
* Activate timer
@@ -152,11 +156,13 @@
*/
if (expect_close == 42) {
softdog_stop();
+ clear_bit(SOFTDOG_TIMER_RUNNING, &driver_status);
+ module_put(THIS_MODULE);
} else {
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
softdog_keepalive();
}
- clear_bit(0, &timer_alive);
+ clear_bit(SOFTDOG_DEVICE_OPEN, &driver_status);
expect_close = 0;
return 0;
}
--Chuck Ebbert 13-Oct-04 19:55:30
next reply other threads:[~2004-10-13 23:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-13 23:55 Chuck Ebbert [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-10-11 17:01 Chuck Ebbert
2004-10-11 20:00 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200410131959_MC3-1-8C24-188B@compuserve.com \
--to=76306.1226@compuserve.com \
--cc=akpm@osdl.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=schierlm@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®