Commit 10e38c63 authored by Pavel Emelyanov's avatar Pavel Emelyanov

zdtm: Fix race in locks08 test

The sub-process should wait for the parent task signal before
checking the locks status
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 36faa047
......@@ -52,14 +52,18 @@ int main(int argc, char **argv)
int pid;
int status;
int ret = 0;
task_waiter_t tw;
struct flock lck;
test_init(argc, argv);
if (init_file_lock(&fd, &lck))
return -1;
task_waiter_init(&tw);
pid = fork();
if (pid == 0) {
task_waiter_wait4(&tw, getppid());
if (check_file_lock_restored(getpid(), fd, &lck) ||
check_lock_exists(filename, &lck) < 0)
ret = -1;
......@@ -69,6 +73,8 @@ int main(int argc, char **argv)
test_daemon();
test_waitsig();
task_waiter_complete_current(&tw);
if (check_file_lock_restored(getpid(), fd, &lck) ||
check_lock_exists(filename, &lck) < 0)
fail("OFD file locks check failed\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment