[LTP] [PATCH v1] Fix synchronization problem with dio tests

Andrea Cervesato andrea.cervesato@suse.de
Mon Jan 29 11:14:48 CET 2024


From: Andrea Cervesato <andrea.cervesato@suse.com>

When system is really fast processing I/O syscalls, multiple childrean
running I/O operations might lock the parent, causing
tst_reap_childrean() to stuck. By adding a small usleep at the
end of the reading I/O operations, which are used by dio_append and
dio_read tests, we ensure that system has enough breath to end tests
correctly and to process children exit.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 testcases/kernel/io/ltp-aiodio/common.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/io/ltp-aiodio/common.h b/testcases/kernel/io/ltp-aiodio/common.h
index 200bbe18e..281072c3b 100644
--- a/testcases/kernel/io/ltp-aiodio/common.h
+++ b/testcases/kernel/io/ltp-aiodio/common.h
@@ -90,6 +90,8 @@ static inline void io_read(const char *filename, int filesize, volatile int *run
 			if (!*run_child || !tst_remaining_runtime())
 				goto exit;
 		}
+
+		usleep(100);
 	}
 
 exit:
@@ -121,6 +123,8 @@ static inline void io_read_eof(const char *filename, volatile int *run_child)
 				break;
 			}
 		}
+
+		usleep(100);
 	}
 
 	SAFE_CLOSE(fd);
-- 
2.35.3



More information about the ltp mailing list