public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: xuyang.jy <xuyang.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] fs/read_all: Filter /dev/watchdog*
Date: Fri, 16 Mar 2018 13:18:50 +0800	[thread overview]
Message-ID: <5AAB53BA.6000207@cn.fujitsu.com> (raw)
In-Reply-To: <87woydv835.fsf@rpws.prws.suse.cz>

2018/3/15 20:25, Richard Palethorpe write:
> Hello,
>
> yang xu writes:
>
>> On some distros with Magic Close feature or built-in CONFIG_WATCHDOG_NOWAYOUT,
>> just closing /dev/watchdog* enabled by open leads to system reboot as expected.
>>
>> If Magic Close feature is supported, just writing a specific magic character 'V'
>> into /dev/watchdog* before closing it can disable the watchdog.
>>
>> If CONFIG_WATCHDOG_NOWAYOUT is built-in, there is no way to disable the watchdog.
>>
>> Magic Close feature is introduced by:
>> commit 017cf080("watchDog Timer Driver Core - Add Magic Close feature")
>>
>> Please see the following url for detailed watchdog info:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/watchdog/watchdog-api.txt
>>
>> Signed-off-by: yang xu<xuyang.jy@cn.fujitsu.com>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
>>   testcases/kernel/fs/read_all/read_all.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
>> index 81806e7..a841b88 100644
>> --- a/testcases/kernel/fs/read_all/read_all.c
>> +++ b/testcases/kernel/fs/read_all/read_all.c
>> @@ -393,6 +393,9 @@ static void visit_dir(const char *path)
>>   		snprintf(dent_path, MAX_PATH,
>>   			 "%s/%s", path, dent->d_name);
>>
>> +		if (!strncmp(dent_path, "/dev/watchdog", 13))
>> +			continue;
>> +
> I don't think this should be hardcoded because it is OK to read this
> file on some systems. Unfortunately there does not seem to be a reliable
> way to find out if it is OK (/sys/class/watchdog/watchdogn/nowayout is
> not even present on my system)
>
> However perhaps we could set the default for the exclude parameter (-e)
> to /dev/watchdog? Then the user can easily override it, but we won't
> reboot some people's systems by default. What do you think?

Hi Richard
Agreed. We can run read_all with the -e option to exclude the 
/dev/watchdog*, as bleow:

diff --git a/runtest/fs b/runtest/fs
index a595edb..42a9bfc 100644
--- a/runtest/fs
+++ b/runtest/fs
@@ -69,7 +69,7 @@ fs_di fs_di -d $TMPDIR
# Was not sure why it should reside in runtest/crashme and won´t get 
tested ever
proc01 proc01 -m 128

-read_all_dev read_all -d /dev -q -r 10
+read_all_dev read_all -d /dev -e '/dev/watchdog?(0)' -q -r 10
read_all_proc read_all -d /proc -q -r 10
read_all_sys read_all -d /sys -q -r 10

How about this modification?

Best Regards,
Yang Xu

>>   		if (act == DA_UNKNOWN) {
>>   			if (lstat(dent_path,&dent_st))
>>   				tst_res(TINFO | TERRNO, "lstat(%s)", path);
>> --
>> 1.8.3.1
>
> --
> Thank you,
> Richard.
>
>
> .
>




  reply	other threads:[~2018-03-16  5:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14 11:07 [LTP] [PATCH] fs/read_all: Filter /dev/watchdog* yang xu
2018-03-15 12:25 ` Richard Palethorpe
2018-03-16  5:18   ` xuyang.jy [this message]
2018-03-19  9:14     ` Richard Palethorpe
2018-03-19 10:38       ` [LTP] [PATCH v2] runtest/fs: filter /dev/watchdog* for read_all_dev by default yang xu
2018-03-19 14:29         ` Richard Palethorpe
2018-03-20 11:51         ` Cyril Hrubis

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=5AAB53BA.6000207@cn.fujitsu.com \
    --to=xuyang.jy@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /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