Blame SOURCES/0002-stress-shm-skip-stressor-if-dev-shm-is-not-mounted-w.patch
|
|
03988b |
From f424f5b774b7cb0fd7939d28e68db6fa977baea1 Mon Sep 17 00:00:00 2001
|
|
|
03988b |
From: Colin Ian King <colin.i.king@gmail.com>
|
|
|
03988b |
Date: Mon, 21 Nov 2022 12:45:11 +0000
|
|
|
03988b |
Subject: [PATCH 2/3] stress-shm: skip stressor if /dev/shm is not mounted with
|
|
|
03988b |
tmpfs on linux
|
|
|
03988b |
|
|
|
03988b |
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
|
|
|
03988b |
---
|
|
|
03988b |
stress-shm.c | 12 ++++++++++++
|
|
|
03988b |
1 file changed, 12 insertions(+)
|
|
|
03988b |
|
|
|
03988b |
diff --git a/stress-shm.c b/stress-shm.c
|
|
|
03988b |
index 91bcd961aeb1..4e6327ac97d4 100644
|
|
|
03988b |
--- a/stress-shm.c
|
|
|
03988b |
+++ b/stress-shm.c
|
|
|
03988b |
@@ -122,6 +122,18 @@ 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 |
--
|
|
|
03988b |
2.38.1
|
|
|
03988b |
|