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