Merge "Remove persist.sys.fuse == false code paths"
This commit is contained in:
commit
610eba0ad0
6 changed files with 29 additions and 91 deletions
1
Utils.h
1
Utils.h
|
@ -34,7 +34,6 @@ struct DIR;
|
|||
namespace android {
|
||||
namespace vold {
|
||||
|
||||
static const char* kPropFuse = "persist.sys.fuse";
|
||||
static const char* kVoldAppDataIsolationEnabled = "persist.sys.vold_app_data_isolation_enabled";
|
||||
static const char* kExternalStorageSdcardfs = "external_storage.sdcardfs.enabled";
|
||||
|
||||
|
|
|
@ -282,12 +282,6 @@ binder::Status VoldNativeService::mount(
|
|||
return translate(res);
|
||||
}
|
||||
|
||||
if ((mountFlags & MOUNT_FLAG_PRIMARY) != 0) {
|
||||
res = VolumeManager::Instance()->setPrimary(vol);
|
||||
if (res != OK) {
|
||||
return translate(res);
|
||||
}
|
||||
}
|
||||
return translate(OK);
|
||||
}
|
||||
|
||||
|
|
|
@ -369,21 +369,6 @@ int VolumeManager::forgetPartition(const std::string& partGuid, const std::strin
|
|||
return success ? 0 : -1;
|
||||
}
|
||||
|
||||
int VolumeManager::linkPrimary(userid_t userId) {
|
||||
if (!GetBoolProperty(android::vold::kPropFuse, false)) {
|
||||
std::string source(mPrimary->getPath());
|
||||
if (mPrimary->isEmulated()) {
|
||||
source = StringPrintf("%s/%d", source.c_str(), userId);
|
||||
fs_prepare_dir(source.c_str(), 0755, AID_ROOT, AID_ROOT);
|
||||
}
|
||||
|
||||
std::string target(StringPrintf("/mnt/user/%d/primary", userId));
|
||||
LOG(DEBUG) << "Linking " << source << " to " << target;
|
||||
Symlink(source, target);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VolumeManager::destroyEmulatedVolumesForUser(userid_t userId) {
|
||||
// Destroy and remove all unstacked EmulatedVolumes for the user
|
||||
auto i = mInternalEmulatedVolumes.begin();
|
||||
|
@ -464,18 +449,6 @@ int VolumeManager::onUserStarted(userid_t userId) {
|
|||
createEmulatedVolumesForUser(userId);
|
||||
}
|
||||
|
||||
if (!GetBoolProperty(android::vold::kPropFuse, false)) {
|
||||
// Note that sometimes the system will spin up processes from Zygote
|
||||
// before actually starting the user, so we're okay if Zygote
|
||||
// already created this directory.
|
||||
std::string path(StringPrintf("%s/%d", kPathUserMount, userId));
|
||||
fs_prepare_dir(path.c_str(), 0755, AID_ROOT, AID_ROOT);
|
||||
|
||||
if (mPrimary) {
|
||||
linkPrimary(userId);
|
||||
}
|
||||
}
|
||||
|
||||
mStartedUsers.insert(userId);
|
||||
|
||||
createPendingDisksIfNeeded();
|
||||
|
@ -512,14 +485,6 @@ int VolumeManager::onSecureKeyguardStateChanged(bool isShowing) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int VolumeManager::setPrimary(const std::shared_ptr<android::vold::VolumeBase>& vol) {
|
||||
mPrimary = vol;
|
||||
for (userid_t userId : mStartedUsers) {
|
||||
linkPrimary(userId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This code is executed after a fork so it's very important that the set of
|
||||
// methods we call here is strictly limited.
|
||||
//
|
||||
|
@ -718,16 +683,6 @@ bool scanProcProcesses(uid_t uid, userid_t userId, ScanProcCallback callback, vo
|
|||
return true;
|
||||
}
|
||||
|
||||
int VolumeManager::remountUid(uid_t uid, int32_t mountMode) {
|
||||
if (GetBoolProperty(android::vold::kPropFuse, false)) {
|
||||
// TODO(135341433): Implement fuse specific logic.
|
||||
return 0;
|
||||
}
|
||||
return scanProcProcesses(uid, static_cast<userid_t>(-1),
|
||||
forkAndRemountChild, &mountMode) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
// In each app's namespace, mount tmpfs on obb and data dir, and bind mount obb and data
|
||||
// package dirs.
|
||||
static bool remountStorageDirs(int nsFd, const char* android_data_dir, const char* android_obb_dir,
|
||||
|
@ -874,9 +829,6 @@ bool VolumeManager::forkAndRemountStorage(int uid, int pid,
|
|||
|
||||
int VolumeManager::remountAppStorageDirs(int uid, int pid,
|
||||
const std::vector<std::string>& packageNames) {
|
||||
if (!GetBoolProperty(android::vold::kPropFuse, false)) {
|
||||
return 0;
|
||||
}
|
||||
// Only run the remount if fuse is mounted for that user.
|
||||
userid_t userId = multiuser_get_user_id(uid);
|
||||
bool fuseMounted = false;
|
||||
|
|
|
@ -114,9 +114,7 @@ class VolumeManager {
|
|||
void createPendingDisksIfNeeded();
|
||||
int onSecureKeyguardStateChanged(bool isShowing);
|
||||
|
||||
int setPrimary(const std::shared_ptr<android::vold::VolumeBase>& vol);
|
||||
|
||||
int remountUid(uid_t uid, int32_t remountMode);
|
||||
int remountUid(uid_t uid, int32_t remountMode) { return 0; }
|
||||
int remountAppStorageDirs(int uid, int pid, const std::vector<std::string>& packageNames);
|
||||
|
||||
/* Aborts all FUSE filesystems, in case the FUSE daemon is no longer up. */
|
||||
|
|
|
@ -301,8 +301,6 @@ status_t EmulatedVolume::doMount() {
|
|||
|
||||
dev_t before = GetDevice(mSdcardFsFull);
|
||||
|
||||
bool isFuse = base::GetBoolProperty(kPropFuse, false);
|
||||
|
||||
// Mount sdcardfs regardless of FUSE, since we need it to bind-mount on top of the
|
||||
// FUSE volume for various reasons.
|
||||
if (mUseSdcardFs && getMountUserId() == 0) {
|
||||
|
@ -350,7 +348,7 @@ status_t EmulatedVolume::doMount() {
|
|||
sdcardFsPid = 0;
|
||||
}
|
||||
|
||||
if (isFuse && isVisible) {
|
||||
if (isVisible) {
|
||||
// Make sure we unmount sdcardfs if we bail out with an error below
|
||||
auto sdcardfs_unmounter = [&]() {
|
||||
LOG(INFO) << "sdcardfs_unmounter scope_guard running";
|
||||
|
|
|
@ -227,39 +227,36 @@ status_t PublicVolume::doMount() {
|
|||
TEMP_FAILURE_RETRY(waitpid(sdcardFsPid, nullptr, 0));
|
||||
}
|
||||
|
||||
bool isFuse = base::GetBoolProperty(kPropFuse, false);
|
||||
if (isFuse) {
|
||||
// We need to mount FUSE *after* sdcardfs, since the FUSE daemon may depend
|
||||
// on sdcardfs being up.
|
||||
LOG(INFO) << "Mounting public fuse volume";
|
||||
android::base::unique_fd fd;
|
||||
int user_id = getMountUserId();
|
||||
int result = MountUserFuse(user_id, getInternalPath(), stableName, &fd);
|
||||
// We need to mount FUSE *after* sdcardfs, since the FUSE daemon may depend
|
||||
// on sdcardfs being up.
|
||||
LOG(INFO) << "Mounting public fuse volume";
|
||||
android::base::unique_fd fd;
|
||||
int user_id = getMountUserId();
|
||||
int result = MountUserFuse(user_id, getInternalPath(), stableName, &fd);
|
||||
|
||||
if (result != 0) {
|
||||
LOG(ERROR) << "Failed to mount public fuse volume";
|
||||
doUnmount();
|
||||
return -result;
|
||||
}
|
||||
|
||||
mFuseMounted = true;
|
||||
auto callback = getMountCallback();
|
||||
if (callback) {
|
||||
bool is_ready = false;
|
||||
callback->onVolumeChecking(std::move(fd), getPath(), getInternalPath(), &is_ready);
|
||||
if (!is_ready) {
|
||||
LOG(ERROR) << "Failed to complete public volume mount";
|
||||
doUnmount();
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
ConfigureReadAheadForFuse(GetFuseMountPathForUser(user_id, stableName), 256u);
|
||||
|
||||
// See comment in model/EmulatedVolume.cpp
|
||||
ConfigureMaxDirtyRatioForFuse(GetFuseMountPathForUser(user_id, stableName), 40u);
|
||||
if (result != 0) {
|
||||
LOG(ERROR) << "Failed to mount public fuse volume";
|
||||
doUnmount();
|
||||
return -result;
|
||||
}
|
||||
|
||||
mFuseMounted = true;
|
||||
auto callback = getMountCallback();
|
||||
if (callback) {
|
||||
bool is_ready = false;
|
||||
callback->onVolumeChecking(std::move(fd), getPath(), getInternalPath(), &is_ready);
|
||||
if (!is_ready) {
|
||||
LOG(ERROR) << "Failed to complete public volume mount";
|
||||
doUnmount();
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
ConfigureReadAheadForFuse(GetFuseMountPathForUser(user_id, stableName), 256u);
|
||||
|
||||
// See comment in model/EmulatedVolume.cpp
|
||||
ConfigureMaxDirtyRatioForFuse(GetFuseMountPathForUser(user_id, stableName), 40u);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue