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

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