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

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