You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2018/10/24 15:59:38 UTC
[mesos] branch master updated: Used mount(8) to make XFS loop
device mounts.
This is an automated email from the ASF dual-hosted git repository.
jpeach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new cfdf852 Used mount(8) to make XFS loop device mounts.
cfdf852 is described below
commit cfdf852c84a3b8812a1bc08211aae41ec3cf3227
Author: James Peach <jp...@apache.org>
AuthorDate: Wed Oct 24 08:44:40 2018 -0700
Used mount(8) to make XFS loop device mounts.
When we added the `filesystem/linux` isolator to the XFS isolation
tests, we broke them for older Linux distributions (specifically
CentOS 6). The `filesystem/linux` isolator needs to remount the
work directory in shared mode using `mount(8)`, but `mount(8)`
requires the mount point it is manipulating to be present in
`mtab(5)`. Since the XFS tests simply issued a `mount(2)` system
call, `mtab(5)` wasn't updated and the remount would fail. Modern
Linux distributions don't see this problem because `/` is mounted
shared by default, and `mtab(5)` is a symlink to `/proc/self/mounts`
(i.e. always in sync).
The straightforward fix is to run `mount(8)` to make the XFS test
fixture mounts, so that `mount(8)` always sees a consistent view of
`mtab(5)`.
Review: https://reviews.apache.org/r/69132/
---
src/tests/containerizer/xfs_quota_tests.cpp | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/tests/containerizer/xfs_quota_tests.cpp b/src/tests/containerizer/xfs_quota_tests.cpp
index 084df06..b2f977f 100644
--- a/src/tests/containerizer/xfs_quota_tests.cpp
+++ b/src/tests/containerizer/xfs_quota_tests.cpp
@@ -144,12 +144,18 @@ public:
AWAIT_READY(mkfs->status());
ASSERT_SOME_EQ(0, mkfs->status().get());
- ASSERT_SOME(fs::mount(
- loopDevice.get(),
- mntPath,
- "xfs",
- 0, // Flags.
- mountOptions.getOrElse("")));
+ const Try<string> mountCmd = mountOptions.isNone()
+ ? strings::format("mount -t xfs %s %s", loopDevice.get(), mntPath)
+ : strings::format("mount -t xfs -o %s %s %s",
+ mountOptions.get(), loopDevice.get(), mntPath);
+
+ Try<Subprocess> mnt = subprocess(
+ mountCmd.get(), Subprocess::PATH(os::DEV_NULL));
+
+ ASSERT_SOME(mnt);
+ AWAIT_READY(mnt->status());
+ ASSERT_SOME_EQ(0, mnt->status().get());
+
mountPoint = mntPath;
ASSERT_SOME(os::chdir(mountPoint.get()))
@@ -159,7 +165,12 @@ public:
virtual void TearDown()
{
if (mountPoint.isSome()) {
- fs::unmount(mountPoint.get(), MNT_FORCE | MNT_DETACH);
+ Try<Subprocess> umount = subprocess(
+ "umount -l -f " + mountPoint.get(), Subprocess::PATH(os::DEV_NULL));
+
+ ASSERT_SOME(umount);
+ AWAIT_READY(umount->status());
+ ASSERT_SOME_EQ(0, umount->status().get());
}
// Make sure we resume the clock so that we can wait on the