From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/2] ioctl09: wait for udevd complete the uevent handling
Date: Wed, 20 Apr 2022 14:05:41 +0200 [thread overview]
Message-ID: <Yl/3FchHScs8YS6c@yuki> (raw)
In-Reply-To: <20220420114720.1463473-1-liwang@redhat.com>
Hi!
> This is quite necessary to wait for uevent handing settled before
> checking the partition is taken effect.
>
> `udevadm monitor` listening from another terminal:
>
> KERNEL[447.077683] change /devices/virtual/block/loop0 (block)
> KERNEL[447.077939] add /devices/virtual/block/loop0/loop0p1 (block)
> KERNEL[447.077999] add /devices/virtual/block/loop0/loop0p2 (block)
> UDEV [447.081138] change /devices/virtual/block/loop0 (block)
> UDEV [447.083490] add /devices/virtual/block/loop0/loop0p1 (block)
> UDEV [447.086898] add /devices/virtual/block/loop0/loop0p2 (block)
>
> Which helps to get rid of such boring failures:
>
> ioctl09.c:44: TPASS: access /sys/block/loop0/loop0p1 succeeds
> ioctl09.c:52: TPASS: access /dev/loop0p1 succeeds
> ioctl09.c:47: TFAIL: access /sys/block/loop0/loop0p2 fails
> ioctl09.c:55: TFAIL: access /dev/loop0p2 fails
>
> I manually confirmed those failures disappeared from a reproducible system
> even with running 10000 times.
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
> testcases/kernel/syscalls/ioctl/ioctl09.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl09.c b/testcases/kernel/syscalls/ioctl/ioctl09.c
> index 9728ecb9c..533a4a5d0 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl09.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl09.c
> @@ -58,6 +58,10 @@ static void check_partition(int part_num, bool value)
>
> static void verify_ioctl(void)
> {
> + char cmd[BUFSIZ];
> +
> + sprintf(cmd, "udevadm settle --exit-if-exists=%s", dev_path);
> +
> const char *const cmd_parted_old[] = {"parted", "-s", "test.img",
> "mklabel", "msdos", "mkpart",
> "primary", "ext4", "1M", "10M",
> @@ -75,11 +79,13 @@ static void verify_ioctl(void)
>
> loopinfo.lo_flags = LO_FLAGS_PARTSCAN;
> SAFE_IOCTL(dev_fd, LOOP_SET_STATUS, &loopinfo);
> + tst_system(cmd);
> check_partition(1, true);
> check_partition(2, false);
>
> change_partition(cmd_parted_new);
> TST_RETRY_FUNC(ioctl(dev_fd, BLKRRPART, 0), TST_RETVAL_EQ0);
> + tst_system(cmd);
> check_partition(1, true);
> check_partition(2, true);
We allready use TST_RETRY_FN_EXP_BACKOFF() in there with 30 second
timeout isn't that enough? And if it isn't wouldn't simply increasing
the timeout to a minute or two fix the issue?
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-04-20 12:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 11:47 [LTP] [PATCH 1/2] ioctl09: wait for udevd complete the uevent handling Li Wang
2022-04-20 11:47 ` [LTP] [PATCH 2/2] mkswap01: wait for the triggered events to complete Li Wang
2022-04-20 12:07 ` Cyril Hrubis
2022-04-20 20:56 ` Petr Vorel
2022-04-21 2:18 ` Li Wang
2022-04-21 6:44 ` Li Wang
2022-04-21 7:47 ` Petr Vorel
2022-04-20 12:05 ` Cyril Hrubis [this message]
2022-04-20 12:31 ` [LTP] [PATCH 1/2] ioctl09: wait for udevd complete the uevent handling Li Wang
2022-04-20 12:52 ` Cyril Hrubis
2022-04-21 6:36 ` Li Wang
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=Yl/3FchHScs8YS6c@yuki \
--to=chrubis@suse.cz \
--cc=liwang@redhat.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