While /tmp is mounted with tmpfs in the most setup, it still can be a non-mount
point. For example, I'm running the fstests in a container, which does not
mount /tmp inside the container.
Running any test case on such system results in having the following error
printed, which leads to all the test cases fail due to the output difference.
mount: /tmp: not mount point or bad option.
dmesg(1) may have more information after failed mount system call.
These lines are printed by the "mount --make-private" command. So, fix that by
using mountpoint command to check if the directory is a mount point or not.
Fixes: 247ab01fa227 ("check: run tests in a private pid/mount namespace")
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
# and /proc so that child process trees cannot interfere with each other.
if [ -n "${FSTESTS_ISOL}" ]; then
+ # Don't allow changes to these mountpoints to propagate
+ # outside of our mount namespace...
for path in /proc /tmp; do
- mount --make-private "$path"
+ mountpoint "$path" >/dev/null && \
+ mount --make-private "$path"
done
+
+ # ...because here we create new mounts that are private
+ # to this mount namespace that we don't want to escape.
mount -t proc proc /proc
mount -t tmpfs tmpfs /tmp