From 674bed18bd253b1a0f927ffb0ab95221fec3e53b Mon Sep 17 00:00:00 2001 From: Hidehiko Abe Date: Wed, 9 Mar 2016 16:42:10 +0900 Subject: [PATCH] Split slave-bind mount into two. mount(2) does not work with MS_BIND | MS_SLAVE at a time. Instead, this CL calls mount twice. Change-Id: I072fd5377e35fff5ed3fa2798eea084d86fe2977 --- VolumeManager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/VolumeManager.cpp b/VolumeManager.cpp index 9304630..012060b 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -578,11 +578,17 @@ int VolumeManager::remountUid(uid_t uid, const std::string& mode) { _exit(0); } if (TEMP_FAILURE_RETRY(mount(storageSource.c_str(), "/storage", - NULL, MS_BIND | MS_REC | MS_SLAVE, NULL)) == -1) { + NULL, MS_BIND | MS_REC, NULL)) == -1) { PLOG(ERROR) << "Failed to mount " << storageSource << " for " << de->d_name; _exit(1); } + if (TEMP_FAILURE_RETRY(mount(NULL, "/storage", NULL, + MS_REC | MS_SLAVE, NULL)) == -1) { + PLOG(ERROR) << "Failed to set MS_SLAVE to /storage for " + << de->d_name; + _exit(1); + } // Mount user-specific symlink helper into place userid_t user_id = multiuser_get_user_id(uid);