Blame SOURCES/0002-stress-shm-skip-stressor-if-dev-shm-is-not-mounted-w.patch
|
|
551471 |
From f424f5b774b7cb0fd7939d28e68db6fa977baea1 Mon Sep 17 00:00:00 2001
|
|
|
551471 |
From: Colin Ian King <colin.i.king@gmail.com>
|
|
|
551471 |
Date: Mon, 21 Nov 2022 12:45:11 +0000
|
|
|
551471 |
Subject: [PATCH 2/3] stress-shm: skip stressor if /dev/shm is not mounted with
|
|
|
551471 |
tmpfs on linux
|
|
|
551471 |
|
|
|
551471 |
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
|
|
|
551471 |
---
|
|
|
551471 |
stress-shm.c | 12 ++++++++++++
|
|
|
551471 |
1 file changed, 12 insertions(+)
|
|
|
551471 |
|
|
|
551471 |
diff --git a/stress-shm.c b/stress-shm.c
|
|
|
551471 |
index 91bcd961aeb1..4e6327ac97d4 100644
|
|
|
551471 |
--- a/stress-shm.c
|
|
|
551471 |
+++ b/stress-shm.c
|
|
|
551471 |
@@ -122,6 +122,18 @@ static int stress_shm_posix_child(
|
|
|
551471 |
const size_t page_size = args->page_size;
|
|
|
551471 |
struct sigaction sa;
|
|
|
551471 |
|
|
|
551471 |
+#if defined(__linux__)
|
|
|
551471 |
+ /*
|
|
|
551471 |
+ * /dev/shm should be mounted with tmpfs and
|
|
|
551471 |
+ * be writeable, if not shm_open will fail
|
|
|
551471 |
+ */
|
|
|
551471 |
+ if (access("/dev/shm", W_OK) < 0) {
|
|
|
551471 |
+ pr_inf("%s: cannot access /dev/shm for writes, errno=%d (%s) skipping stressor\n",
|
|
|
551471 |
+ args->name, errno, strerror(errno));
|
|
|
551471 |
+ return EXIT_NO_RESOURCE;
|
|
|
551471 |
+ }
|
|
|
551471 |
+#endif
|
|
|
551471 |
+
|
|
|
551471 |
addrs = calloc(shm_posix_objects, sizeof(*addrs));
|
|
|
551471 |
if (!addrs) {
|
|
|
551471 |
pr_fail("%s: calloc on addrs failed, out of memory\n", args->name);
|
|
|
551471 |
--
|
|
|
551471 |
2.38.1
|
|
|
551471 |
|