Skip to content

Commit 389f7ca

Browse files
committed
stress-bind-mount: add more build time checks
Signed-off-by: Colin Ian King <[email protected]>
1 parent d8b9bc3 commit 389f7ca

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

stress-bind-mount.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,25 @@ static int stress_bind_mount_exercise(stress_args_t *args, const char *path)
8787
stress_parent_died_alarm();
8888

8989
do {
90+
static const char skip[] = "skipping stressor";
9091
int rc, retries, stat_count, stat_okay;
9192
DIR *dir;
9293
const struct dirent *d;
9394
double t;
94-
#if defined(HAVE_OPEN_TREE)
95+
#if defined(HAVE_OPEN_TREE) && \
96+
defined(HAVE_MOVE_MOUNT) && \
97+
defined(HAVE_SYS_MOUNT_H)
9598
int fd;
9699
#endif
97100

98101
t = stress_time_now();
99-
#if defined(HAVE_OPEN_TREE)
102+
#if defined(HAVE_OPEN_TREE) && \
103+
defined(HAVE_MOVE_MOUNT) && \
104+
defined(HAVE_SYS_MOUNT_H)
100105
fd = open_tree(-EBADF, bind_to_path, OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC);
101106
if (fd < 0) {
102-
pr_inf_skip("%s: open_tree on '%s' failed, errno=%d (%s), "
103-
"skipping stressor\n", args->name, path,
104-
errno, strerror(errno));
107+
pr_inf_skip("%s: open_tree on '%s' failed, errno=%d (%s), %s\n",
108+
args->name, path, errno, strerror(errno), skip);
105109
(void)shim_rmdir(path);
106110
return EXIT_NO_RESOURCE;
107111
}
@@ -112,9 +116,8 @@ static int stress_bind_mount_exercise(stress_args_t *args, const char *path)
112116
#endif
113117
if (rc < 0) {
114118
if ((errno == EACCES) || (errno == ENOENT)) {
115-
pr_inf_skip("%s: bind mount failed, errno=%d (%s), "
116-
"skipping stressor\n", args->name,
117-
errno, strerror(errno));
119+
pr_inf_skip("%s: bind mount failed, errno=%d (%s), %s\n",
120+
args->name, errno, strerror(errno), skip);
118121
(void)shim_rmdir(path);
119122
return EXIT_NO_RESOURCE;
120123
}

0 commit comments

Comments
 (0)