@@ -24,7 +24,7 @@
#include <libaio.h>
#include "common.h"
-static int *run_child;
+static volatile int *run_child;
static char *str_numchildren;
static char *str_writesize;
@@ -133,7 +133,7 @@ static void cleanup(void)
{
if (run_child) {
*run_child = 0;
- SAFE_MUNMAP(run_child, sizeof(int));
+ SAFE_MUNMAP((void *)run_child, sizeof(int));
}
}
@@ -28,7 +28,7 @@
#include <libaio.h>
#include "common.h"
-static int *run_child;
+static volatile int *run_child;
static char *str_numchildren;
static char *str_writesize;
@@ -181,7 +181,7 @@ static void cleanup(void)
{
if (run_child) {
*run_child = 0;
- SAFE_MUNMAP(run_child, sizeof(int));
+ SAFE_MUNMAP((void *)run_child, sizeof(int));
}
}
@@ -19,7 +19,7 @@
#include "tst_test.h"
#include "common.h"
-static int *run_child;
+static volatile int *run_child;
static char *str_numchildren;
static char *str_writesize;
@@ -49,7 +49,10 @@ static void setup(void)
static void cleanup(void)
{
- SAFE_MUNMAP(run_child, sizeof(int));
+ if (run_child) {
+ *run_child = 0;
+ SAFE_MUNMAP((void *)run_child, sizeof(int));
+ }
}
static void run(void)
@@ -26,7 +26,7 @@
#include "tst_test.h"
#include "common.h"
-static int *run_child;
+static volatile int *run_child;
static char *str_numchildren;
static char *str_writesize;
@@ -85,7 +85,7 @@ static void cleanup(void)
{
if (run_child) {
*run_child = 0;
- SAFE_MUNMAP(run_child, sizeof(int));
+ SAFE_MUNMAP((void *)run_child, sizeof(int));
}
}
@@ -33,7 +33,7 @@
#include "tst_test.h"
#include "common.h"
-static int *run_child;
+static volatile int *run_child;
static char *str_numchildren;
static char *str_filesize;
@@ -109,7 +109,7 @@ static void cleanup(void)
{
if (run_child) {
*run_child = 0;
- SAFE_MUNMAP(run_child, sizeof(int));
+ SAFE_MUNMAP((void *)run_child, sizeof(int));
}
}
run_child flag is commonly used by aiodio tests in order to check if tests are passed or not and compiler seems to optimize run_child flag because it's not defined as volatile. With this patch we ensure that the flag is set as volatile so tests will work as expected on s390. Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.de> --- testcases/kernel/io/ltp-aiodio/aiodio_append.c | 4 ++-- testcases/kernel/io/ltp-aiodio/aiodio_sparse.c | 4 ++-- testcases/kernel/io/ltp-aiodio/dio_append.c | 7 +++++-- testcases/kernel/io/ltp-aiodio/dio_sparse.c | 4 ++-- testcases/kernel/io/ltp-aiodio/dio_truncate.c | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-)