From 1de3ab901368c510c906d3d4e4b9a912af05e7e8 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Tue, 5 Nov 2024 18:04:32 +0000 Subject: [PATCH] Revert^5 "Set block device as RO/RW before mount" This reverts commit 5fd1be1a5a90f4e53d6e7f6bd8562d1940271773. Reason for revert: b/377081806 Change-Id: I9c5761f6193979795e4350c9c7f89f18b9a868fd --- fs_mgr/fs_mgr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index ea2e3a8c7..5156754a8 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -826,9 +826,6 @@ static int __mount(const std::string& source, const std::string& target, const F if (read_only) { mountflags |= MS_RDONLY; } - if (!fs_mgr_set_blk_ro(source, read_only)) { - PLOG(ERROR) << "Failed to set " << source << " as " << (read_only ? "RO" : "RW"); - } int ret = 0; int save_errno = 0; int gc_allowance = 0; @@ -883,6 +880,9 @@ static int __mount(const std::string& source, const std::string& target, const F } PINFO << __FUNCTION__ << "(source=" << source << source_missing << ",target=" << target << target_missing << ",type=" << entry.fs_type << ")=" << ret; + if ((ret == 0) && (mountflags & MS_RDONLY) != 0) { + fs_mgr_set_blk_ro(source); + } if (ret == 0) { android::base::SetProperty("ro.boottime.init.mount." + Basename(target), std::to_string(t.duration().count()));