Blame SOURCES/0003-stress-shm-move-dev-shm-check-to-earlier-in-the-setu.patch

616e93
From 7681f2d05470b8c8850346bcf12e525f628941b3 Mon Sep 17 00:00:00 2001
616e93
From: Colin Ian King <colin.i.king@gmail.com>
616e93
Date: Mon, 21 Nov 2022 12:46:54 +0000
616e93
Subject: [PATCH 3/3] stress-shm: move /dev/shm check to earlier in the setup
616e93
 phase
616e93
616e93
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
616e93
---
616e93
 stress-shm.c | 23 +++++++++++------------
616e93
 1 file changed, 11 insertions(+), 12 deletions(-)
616e93
616e93
diff --git a/stress-shm.c b/stress-shm.c
616e93
index 4e6327ac97d4..a9c26498024e 100644
616e93
--- a/stress-shm.c
616e93
+++ b/stress-shm.c
616e93
@@ -122,18 +122,6 @@ static int stress_shm_posix_child(
616e93
 	const size_t page_size = args->page_size;
616e93
 	struct sigaction sa;
616e93
 
616e93
-#if defined(__linux__)
616e93
-	/*
616e93
-	 *  /dev/shm should be mounted with tmpfs and
616e93
-	 *  be writeable, if not shm_open will fail
616e93
-	 */
616e93
-	if (access("/dev/shm", W_OK) < 0) {
616e93
-		pr_inf("%s: cannot access /dev/shm for writes, errno=%d (%s) skipping stressor\n",
616e93
-			args->name, errno, strerror(errno));
616e93
-		return EXIT_NO_RESOURCE;
616e93
-	}
616e93
-#endif
616e93
-
616e93
 	addrs = calloc(shm_posix_objects, sizeof(*addrs));
616e93
 	if (!addrs) {
616e93
 		pr_fail("%s: calloc on addrs failed, out of memory\n", args->name);
616e93
@@ -384,6 +372,17 @@ static int stress_shm(const stress_args_t *args)
616e93
 	}
616e93
 	orig_sz = sz = shm_posix_bytes & ~(page_size - 1);
616e93
 
616e93
+#if defined(__linux__)
616e93
+	/*
616e93
+	 *  /dev/shm should be mounted with tmpfs and
616e93
+	 *  be writeable, if not shm_open will fail
616e93
+	 */
616e93
+	if (access("/dev/shm", W_OK) < 0) {
616e93
+		pr_inf("%s: cannot access /dev/shm for writes, errno=%d (%s) skipping stressor\n",
616e93
+			args->name, errno, strerror(errno));
616e93
+		return EXIT_NO_RESOURCE;
616e93
+	}
616e93
+#endif
616e93
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
616e93
 
616e93
 	while (keep_stressing_flag() && retry) {
616e93
-- 
616e93
2.38.1
616e93