Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b08f1884 authored by Zimuzo Ezeozue's avatar Zimuzo Ezeozue Committed by android-build-merger
Browse files

Merge "Fix installd mount paths with FUSE"

am: b24bb22f

Change-Id: I0ea4179783b382debf88dc81d97a69d3821d6fd2
parents a46ba8ce b24bb22f
Loading
Loading
Loading
Loading
+5 −15
Original line number Diff line number Diff line
@@ -103,6 +103,9 @@ static constexpr size_t kSha256Size = 32;
static constexpr const char* kPropApkVerityMode = "ro.apk_verity.mode";
static constexpr const char* kFuseProp = "persist.sys.fuse";

static constexpr const char* kMntSdcardfs = "/mnt/runtime/default/";
static constexpr const char* kMntFuse = "/mnt/pass_through/0/";

namespace {

constexpr const char* kDump = "android.permission.DUMP";
@@ -2797,15 +2800,13 @@ binder::Status InstalldNativeService::invalidateMounts() {
        std::getline(in, ignored);

        if (android::base::GetBoolProperty(kFuseProp, false)) {
            // TODO(b/146139106): Use sdcardfs mounts on devices running sdcardfs so we don't bypass
            // it's VFS cache
            if (target.compare(0, 17, "/mnt/pass_through") == 0) {
            if (target.find(kMntFuse) == 0) {
                LOG(DEBUG) << "Found storage mount " << source << " at " << target;
                mStorageMounts[source] = target;
            }
        } else {
#if !BYPASS_SDCARDFS
            if (target.compare(0, 21, "/mnt/runtime/default/") == 0) {
            if (target.find(kMntSdcardfs) == 0) {
                LOG(DEBUG) << "Found storage mount " << source << " at " << target;
                mStorageMounts[source] = target;
            }
@@ -2820,17 +2821,6 @@ std::string InstalldNativeService::findDataMediaPath(
    std::lock_guard<std::recursive_mutex> lock(mMountsLock);
    const char* uuid_ = uuid ? uuid->c_str() : nullptr;
    auto path = StringPrintf("%s/media", create_data_path(uuid_).c_str());
    if (android::base::GetBoolProperty(kFuseProp, false)) {
        // TODO(b/146139106): This is only safe on devices not running sdcardfs where there is no
        // risk of bypassing the sdcardfs VFS cache

        // Always use the lower filesystem path on FUSE enabled devices not running sdcardfs
        // The upper filesystem path, /mnt/pass_through/<userid>/<vol>/ which was a bind mount
        // to the lower filesytem may have been unmounted already when a user is
        // removed and the path will now be pointing to a tmpfs without content
        return StringPrintf("%s/%u", path.c_str(), userid);
    }

    auto resolved = mStorageMounts[path];
    if (resolved.empty()) {
        LOG(WARNING) << "Failed to find storage mount for " << path;