Re: [LTP] [PATCH 1/1 1/1] Add ioctl_loop08 test for LOOP_GET_STATUS lock imbalance

Cyril Hrubis
2023-02-10T10:47:59Z

Hi!
> +static void verify_ioctl_loop(void)
> +{
> + struct tcase *tc = &tcases[0];
> + pthread_t th1, th2;
> +
> + pthread_create(&th1, NULL, ioctl_thread, tc);
> + usleep(500000);
> + pthread_create(&th2, NULL, ioctl_thread, tc + 1);
> + usleep(500000);

This part looks strange, why do we run the code that calls the ioctl in
a separate thread if we are sleeping after the thread has been created
and quite likely the thread will finish before the main thread returns
from the sleep?

Why can we just call the ioctl_thread() sequentially here?

> + if (!find_kmsg(lock_imbalance))
> + tst_res(TFAIL, "Trigger lock imbalance");
> + else
> + tst_res(TPASS, "Nothing bad happened, probably");
> +}
> +
> +static struct tst_test test = {
> + .test_all = verify_ioctl_loop,
> + .needs_root = 1,
> + .needs_kconfigs = (const char *[]) {
> + "CONFIG_LOCKDEP=y",
> + NULL },
> + .tags = (const struct tst_tag[]) {
> + { "linux-git", "bdac616db9bb "},
> + {}
> + },
> + .needs_drivers = (const char *const[]) {
> + "loop",
> + NULL }

The whitespaces here are all messed up.

> +};
> --
> 2.20.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp

--
Cyril Hrubis
chrubis@suse.cz