[LTP] [PATCH v3] Add read_all file systems test

Cyril Hrubis chrubis@suse.cz
Tue Mar 6 17:05:23 CET 2018


Hi!
> +CFLAGS			+= -D_GNU_SOURCE
> +LDFLAGS 		+= -lpthread

The only supported way how to compile and link with pthreads is by
adding -pthread to CFLAGS (it's written in each pthread related manual
page).

...

> +static void stop_workers(void)
> +{
> +	const char stop_code[1] = { '\0' };
> +	int i;
> +
> +	if (!workers)
> +		return;
> +
> +	for (i = 0; i < worker_count; i++) {
> +		if (workers[i].q)
> +			queue_push(workers[i].q, stop_code);
> +	}

So here we are relying on fact that there was enough space to store
empty string in the queue, which will be likely true, but shouldn't we
rather do something as while (!queue_push(workers[i].q, stop_code));
instead just to be sure?

I suppose that if we fail this the test will hang in tst_reap_children()
because the reading threads will end up stuck in the semaphores, which
is not that big deal anyways.

> +	for (i = 0; i < worker_count; i++) {
> +		if (workers[i].q) {
> +			queue_destroy(workers[i].q, 0);
> +			workers[i].q = 0;
> +		}
> +	}
> +}

Other than that this looks good to me.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list