* [PATCH] watchdog/xen: don't clear is_active when xen_wdt_stop() failed
@ 2012-03-19 9:32 ` Jan Beulich
0 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2012-03-19 9:32 UTC (permalink / raw)
To: wim, Konrad Rzeszutek Wilk; +Cc: xen-devel, linux-watchdog
xen_wdt_release() shouldn't clear is_active even when the watchdog
didn't get stopped (which by itself shouldn't happen, but let's return
a proper error in this case rather than adding a BUG() upon hypercall
failure).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
drivers/watchdog/xen_wdt.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- 3.3/drivers/watchdog/xen_wdt.c
+++ 3.3-xen-watchdog-release/drivers/watchdog/xen_wdt.c
@@ -131,16 +131,18 @@ static int xen_wdt_open(struct inode *in
static int xen_wdt_release(struct inode *inode, struct file *file)
{
+ int err = 0;
+
if (expect_release)
- xen_wdt_stop();
+ err = xen_wdt_stop();
else {
printk(KERN_CRIT PFX
"unexpected close, not stopping watchdog!\n");
xen_wdt_kick();
}
- is_active = false;
+ is_active = err;
expect_release = false;
- return 0;
+ return err;
}
static ssize_t xen_wdt_write(struct file *file, const char __user *data,
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] watchdog/xen: don't clear is_active when xen_wdt_stop() failed
@ 2012-03-19 9:32 ` Jan Beulich
0 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2012-03-19 9:32 UTC (permalink / raw)
To: wim, Konrad Rzeszutek Wilk; +Cc: linux-watchdog, xen-devel
xen_wdt_release() shouldn't clear is_active even when the watchdog
didn't get stopped (which by itself shouldn't happen, but let's return
a proper error in this case rather than adding a BUG() upon hypercall
failure).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
drivers/watchdog/xen_wdt.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- 3.3/drivers/watchdog/xen_wdt.c
+++ 3.3-xen-watchdog-release/drivers/watchdog/xen_wdt.c
@@ -131,16 +131,18 @@ static int xen_wdt_open(struct inode *in
static int xen_wdt_release(struct inode *inode, struct file *file)
{
+ int err = 0;
+
if (expect_release)
- xen_wdt_stop();
+ err = xen_wdt_stop();
else {
printk(KERN_CRIT PFX
"unexpected close, not stopping watchdog!\n");
xen_wdt_kick();
}
- is_active = false;
+ is_active = err;
expect_release = false;
- return 0;
+ return err;
}
static ssize_t xen_wdt_write(struct file *file, const char __user *data,
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] watchdog/xen: don't clear is_active when xen_wdt_stop() failed
2012-03-19 9:32 ` Jan Beulich
@ 2012-03-21 17:23 ` Konrad Rzeszutek Wilk
-1 siblings, 0 replies; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-03-21 17:23 UTC (permalink / raw)
To: Jan Beulich, wim; +Cc: wim, xen-devel, linux-watchdog
On Mon, Mar 19, 2012 at 09:32:28AM +0000, Jan Beulich wrote:
> xen_wdt_release() shouldn't clear is_active even when the watchdog
> didn't get stopped (which by itself shouldn't happen, but let's return
> a proper error in this case rather than adding a BUG() upon hypercall
> failure).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Looks good to me too. Wim, want me to carry it for 3.4?
>
> ---
> drivers/watchdog/xen_wdt.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> --- 3.3/drivers/watchdog/xen_wdt.c
> +++ 3.3-xen-watchdog-release/drivers/watchdog/xen_wdt.c
> @@ -131,16 +131,18 @@ static int xen_wdt_open(struct inode *in
>
> static int xen_wdt_release(struct inode *inode, struct file *file)
> {
> + int err = 0;
> +
> if (expect_release)
> - xen_wdt_stop();
> + err = xen_wdt_stop();
> else {
> printk(KERN_CRIT PFX
> "unexpected close, not stopping watchdog!\n");
> xen_wdt_kick();
> }
> - is_active = false;
> + is_active = err;
> expect_release = false;
> - return 0;
> + return err;
> }
>
> static ssize_t xen_wdt_write(struct file *file, const char __user *data,
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] watchdog/xen: don't clear is_active when xen_wdt_stop() failed
@ 2012-03-21 17:23 ` Konrad Rzeszutek Wilk
0 siblings, 0 replies; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-03-21 17:23 UTC (permalink / raw)
To: Jan Beulich; +Cc: wim, linux-watchdog, xen-devel
On Mon, Mar 19, 2012 at 09:32:28AM +0000, Jan Beulich wrote:
> xen_wdt_release() shouldn't clear is_active even when the watchdog
> didn't get stopped (which by itself shouldn't happen, but let's return
> a proper error in this case rather than adding a BUG() upon hypercall
> failure).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Looks good to me too. Wim, want me to carry it for 3.4?
>
> ---
> drivers/watchdog/xen_wdt.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> --- 3.3/drivers/watchdog/xen_wdt.c
> +++ 3.3-xen-watchdog-release/drivers/watchdog/xen_wdt.c
> @@ -131,16 +131,18 @@ static int xen_wdt_open(struct inode *in
>
> static int xen_wdt_release(struct inode *inode, struct file *file)
> {
> + int err = 0;
> +
> if (expect_release)
> - xen_wdt_stop();
> + err = xen_wdt_stop();
> else {
> printk(KERN_CRIT PFX
> "unexpected close, not stopping watchdog!\n");
> xen_wdt_kick();
> }
> - is_active = false;
> + is_active = err;
> expect_release = false;
> - return 0;
> + return err;
> }
>
> static ssize_t xen_wdt_write(struct file *file, const char __user *data,
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] watchdog/xen: don't clear is_active when xen_wdt_stop() failed
2012-03-19 9:32 ` Jan Beulich
@ 2012-03-21 19:50 ` Wim Van Sebroeck
-1 siblings, 0 replies; 8+ messages in thread
From: Wim Van Sebroeck @ 2012-03-21 19:50 UTC (permalink / raw)
To: Jan Beulich; +Cc: Konrad Rzeszutek Wilk, xen-devel, linux-watchdog
Hi Jan,
> xen_wdt_release() shouldn't clear is_active even when the watchdog
> didn't get stopped (which by itself shouldn't happen, but let's return
> a proper error in this case rather than adding a BUG() upon hypercall
> failure).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> ---
> drivers/watchdog/xen_wdt.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> --- 3.3/drivers/watchdog/xen_wdt.c
> +++ 3.3-xen-watchdog-release/drivers/watchdog/xen_wdt.c
> @@ -131,16 +131,18 @@ static int xen_wdt_open(struct inode *in
>
> static int xen_wdt_release(struct inode *inode, struct file *file)
> {
> + int err = 0;
> +
> if (expect_release)
> - xen_wdt_stop();
> + err = xen_wdt_stop();
> else {
> printk(KERN_CRIT PFX
> "unexpected close, not stopping watchdog!\n");
> xen_wdt_kick();
> }
> - is_active = false;
> + is_active = err;
> expect_release = false;
> - return 0;
> + return err;
> }
>
> static ssize_t xen_wdt_write(struct file *file, const char __user *data,
Just for my understanding:
is_active is a bool value and err is an integer. What values are returned by xen_wdt_stop?
Kind regards,
Wim.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] watchdog/xen: don't clear is_active when xen_wdt_stop() failed
@ 2012-03-21 19:50 ` Wim Van Sebroeck
0 siblings, 0 replies; 8+ messages in thread
From: Wim Van Sebroeck @ 2012-03-21 19:50 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, linux-watchdog, Konrad Rzeszutek Wilk
Hi Jan,
> xen_wdt_release() shouldn't clear is_active even when the watchdog
> didn't get stopped (which by itself shouldn't happen, but let's return
> a proper error in this case rather than adding a BUG() upon hypercall
> failure).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> ---
> drivers/watchdog/xen_wdt.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> --- 3.3/drivers/watchdog/xen_wdt.c
> +++ 3.3-xen-watchdog-release/drivers/watchdog/xen_wdt.c
> @@ -131,16 +131,18 @@ static int xen_wdt_open(struct inode *in
>
> static int xen_wdt_release(struct inode *inode, struct file *file)
> {
> + int err = 0;
> +
> if (expect_release)
> - xen_wdt_stop();
> + err = xen_wdt_stop();
> else {
> printk(KERN_CRIT PFX
> "unexpected close, not stopping watchdog!\n");
> xen_wdt_kick();
> }
> - is_active = false;
> + is_active = err;
> expect_release = false;
> - return 0;
> + return err;
> }
>
> static ssize_t xen_wdt_write(struct file *file, const char __user *data,
Just for my understanding:
is_active is a bool value and err is an integer. What values are returned by xen_wdt_stop?
Kind regards,
Wim.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] watchdog/xen: don't clear is_active when xen_wdt_stop() failed
2012-03-21 19:50 ` Wim Van Sebroeck
@ 2012-03-22 8:13 ` Jan Beulich
-1 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2012-03-22 8:13 UTC (permalink / raw)
To: Wim Van Sebroeck; +Cc: xen-devel, Konrad Rzeszutek Wilk, linux-watchdog
>>> On 21.03.12 at 20:50, Wim Van Sebroeck <wim@iguana.be> wrote:
> Hi Jan,
>
>> xen_wdt_release() shouldn't clear is_active even when the watchdog
>> didn't get stopped (which by itself shouldn't happen, but let's return
>> a proper error in this case rather than adding a BUG() upon hypercall
>> failure).
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> ---
>> drivers/watchdog/xen_wdt.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> --- 3.3/drivers/watchdog/xen_wdt.c
>> +++ 3.3-xen-watchdog-release/drivers/watchdog/xen_wdt.c
>> @@ -131,16 +131,18 @@ static int xen_wdt_open(struct inode *in
>>
>> static int xen_wdt_release(struct inode *inode, struct file *file)
>> {
>> + int err = 0;
>> +
>> if (expect_release)
>> - xen_wdt_stop();
>> + err = xen_wdt_stop();
>> else {
>> printk(KERN_CRIT PFX
>> "unexpected close, not stopping watchdog!\n");
>> xen_wdt_kick();
>> }
>> - is_active = false;
>> + is_active = err;
>> expect_release = false;
>> - return 0;
>> + return err;
>> }
>>
>> static ssize_t xen_wdt_write(struct file *file, const char __user *data,
>
> Just for my understanding:
> is_active is a bool value and err is an integer. What values are returned by
> xen_wdt_stop?
xen_wdt_stop() returns the usual -errno values. Assignments from
non-bool to bool convert the value (non-zero -> true, zero -> false),
i.e. is_active gets set to false only if xen_wdt_stop() succeeded.
Jan
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] watchdog/xen: don't clear is_active when xen_wdt_stop() failed
@ 2012-03-22 8:13 ` Jan Beulich
0 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2012-03-22 8:13 UTC (permalink / raw)
To: Wim Van Sebroeck; +Cc: Konrad Rzeszutek Wilk, linux-watchdog, xen-devel
>>> On 21.03.12 at 20:50, Wim Van Sebroeck <wim@iguana.be> wrote:
> Hi Jan,
>
>> xen_wdt_release() shouldn't clear is_active even when the watchdog
>> didn't get stopped (which by itself shouldn't happen, but let's return
>> a proper error in this case rather than adding a BUG() upon hypercall
>> failure).
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> ---
>> drivers/watchdog/xen_wdt.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> --- 3.3/drivers/watchdog/xen_wdt.c
>> +++ 3.3-xen-watchdog-release/drivers/watchdog/xen_wdt.c
>> @@ -131,16 +131,18 @@ static int xen_wdt_open(struct inode *in
>>
>> static int xen_wdt_release(struct inode *inode, struct file *file)
>> {
>> + int err = 0;
>> +
>> if (expect_release)
>> - xen_wdt_stop();
>> + err = xen_wdt_stop();
>> else {
>> printk(KERN_CRIT PFX
>> "unexpected close, not stopping watchdog!\n");
>> xen_wdt_kick();
>> }
>> - is_active = false;
>> + is_active = err;
>> expect_release = false;
>> - return 0;
>> + return err;
>> }
>>
>> static ssize_t xen_wdt_write(struct file *file, const char __user *data,
>
> Just for my understanding:
> is_active is a bool value and err is an integer. What values are returned by
> xen_wdt_stop?
xen_wdt_stop() returns the usual -errno values. Assignments from
non-bool to bool convert the value (non-zero -> true, zero -> false),
i.e. is_active gets set to false only if xen_wdt_stop() succeeded.
Jan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-03-22 8:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-19 9:32 [PATCH] watchdog/xen: don't clear is_active when xen_wdt_stop() failed Jan Beulich
2012-03-19 9:32 ` Jan Beulich
2012-03-21 17:23 ` Konrad Rzeszutek Wilk
2012-03-21 17:23 ` Konrad Rzeszutek Wilk
2012-03-21 19:50 ` Wim Van Sebroeck
2012-03-21 19:50 ` Wim Van Sebroeck
2012-03-22 8:13 ` Jan Beulich
2012-03-22 8:13 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.