Skip to content

Commit

Permalink
vold: metadata encryption: ensure F2FS GC targets correct device.
Browse files Browse the repository at this point in the history
This fixes F2FS GC failure in idle-maint.

Bug: 111953875
Change-Id: I1d10802121d5641cf9ba780fee249affd2cf6ffe
Merged-In: I1d10802121d5641cf9ba780fee249affd2cf6ffe
Test: Tested by hand
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
Jaegeuk Kim authored and ciphergoth committed Sep 18, 2018
1 parent 6418bb7 commit 1251ef0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions IdleMaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include "IdleMaint.h"
#include "FileDeviceUtils.h"
#include "Utils.h"
#include "VolumeManager.h"
#include "model/PrivateVolume.h"
Expand Down Expand Up @@ -92,8 +93,8 @@ static void addFromVolumeManager(std::list<std::string>* paths,
} else if (path_type == PathTypes::kBlkDevice) {
std::string gc_path;
const std::string& fs_type = vol->getFsType();
if (fs_type == "f2fs" &&
Realpath(vol->getRawDevPath(), &gc_path)) {
if (fs_type == "f2fs" && (Realpath(vol->getRawDmDevPath(), &gc_path) ||
Realpath(vol->getRawDevPath(), &gc_path))) {
paths->push_back(std::string("/sys/fs/") + fs_type +
"/" + Basename(gc_path));
}
Expand Down Expand Up @@ -137,7 +138,8 @@ static void addFromFstab(std::list<std::string>* paths, PathTypes path_type) {
} else if (path_type == PathTypes::kBlkDevice) {
std::string gc_path;
if (std::string(fstab->recs[i].fs_type) == "f2fs" &&
Realpath(fstab->recs[i].blk_device, &gc_path)) {
Realpath(android::vold::BlockDeviceForPath(
std::string(fstab->recs[i].mount_point) + "/"), &gc_path)) {
paths->push_back(std::string("/sys/fs/") + fstab->recs[i].fs_type +
"/" + Basename(gc_path));
}
Expand Down
1 change: 1 addition & 0 deletions model/PrivateVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class PrivateVolume : public VolumeBase {
virtual ~PrivateVolume();
const std::string& getFsType() { return mFsType; };
const std::string& getRawDevPath() { return mRawDevPath; };
const std::string& getRawDmDevPath() { return mDmDevPath; };

protected:
status_t doCreate() override;
Expand Down

0 comments on commit 1251ef0

Please sign in to comment.