Merge "Add persist.sys.fuse.bpf.override"

This commit is contained in:
Paul Lawrence 2022-12-16 16:49:54 +00:00 committed by Gerrit Code Review
commit c4bc218452
3 changed files with 11 additions and 8 deletions

View file

@ -1774,7 +1774,15 @@ std::pair<android::base::unique_fd, std::string> OpenDirInProcfs(std::string_vie
bool IsFuseBpfEnabled() { bool IsFuseBpfEnabled() {
// TODO Once kernel supports flag, trigger off kernel flag unless // TODO Once kernel supports flag, trigger off kernel flag unless
// ro.fuse.bpf.enabled is explicitly set to false // ro.fuse.bpf.enabled is explicitly set to false
if (base::GetBoolProperty("ro.fuse.bpf.enabled", false)) { bool enabled;
if (base::GetProperty("ro.fuse.bpf.is_running", "") != "")
enabled = base::GetBoolProperty("ro.fuse.bpf.is_running", false);
else if (base::GetProperty("persist.sys.fuse.bpf.override", "") != "")
enabled = base::GetBoolProperty("persist.sys.fuse.bpf.override", false);
else
enabled = base::GetBoolProperty("ro.fuse.bpf.enabled", false);
if (enabled) {
base::SetProperty("ro.fuse.bpf.is_running", "true"); base::SetProperty("ro.fuse.bpf.is_running", "true");
return true; return true;
} else { } else {

View file

@ -50,7 +50,6 @@ EmulatedVolume::EmulatedVolume(const std::string& rawPath, int userId)
mRawPath = rawPath; mRawPath = rawPath;
mLabel = "emulated"; mLabel = "emulated";
mFuseMounted = false; mFuseMounted = false;
mFuseBpfEnabled = IsFuseBpfEnabled();
mUseSdcardFs = IsSdcardfsUsed(); mUseSdcardFs = IsSdcardfsUsed();
mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false); mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
} }
@ -62,7 +61,6 @@ EmulatedVolume::EmulatedVolume(const std::string& rawPath, dev_t device, const s
mRawPath = rawPath; mRawPath = rawPath;
mLabel = fsUuid; mLabel = fsUuid;
mFuseMounted = false; mFuseMounted = false;
mFuseBpfEnabled = IsFuseBpfEnabled();
mUseSdcardFs = IsSdcardfsUsed(); mUseSdcardFs = IsSdcardfsUsed();
mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false); mAppDataIsolationEnabled = base::GetBoolProperty(kVoldAppDataIsolationEnabled, false);
} }
@ -446,7 +444,7 @@ status_t EmulatedVolume::doMount() {
} }
} }
if (!mFuseBpfEnabled) { if (!IsFuseBpfEnabled()) {
// Only do the bind-mounts when we know for sure the FUSE daemon can resolve the path. // Only do the bind-mounts when we know for sure the FUSE daemon can resolve the path.
res = mountFuseBindMounts(); res = mountFuseBindMounts();
if (res != OK) { if (res != OK) {
@ -505,7 +503,7 @@ status_t EmulatedVolume::doUnmount() {
if (mFuseMounted) { if (mFuseMounted) {
std::string label = getLabel(); std::string label = getLabel();
if (!mFuseBpfEnabled) { if (!IsFuseBpfEnabled()) {
// Ignoring unmount return status because we do want to try to // Ignoring unmount return status because we do want to try to
// unmount the rest cleanly. // unmount the rest cleanly.
unmountFuseBindMounts(); unmountFuseBindMounts();

View file

@ -66,9 +66,6 @@ class EmulatedVolume : public VolumeBase {
/* Whether we mounted FUSE for this volume */ /* Whether we mounted FUSE for this volume */
bool mFuseMounted; bool mFuseMounted;
/* Whether the FUSE BPF feature is enabled */
bool mFuseBpfEnabled;
/* Whether to use sdcardfs for this volume */ /* Whether to use sdcardfs for this volume */
bool mUseSdcardFs; bool mUseSdcardFs;