diff options
author | Jeff Sharkey <jsharkey@android.com> | 2018-01-07 19:17:39 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2018-01-07 19:24:55 -0700 |
commit | 47dc236d2f3227b4d952ad490939f7c9b0f8c90b (patch) | |
tree | 10c1a6faf1bb227bddd94b7628e58b1750c6a4e9 /fs_mgr | |
parent | 354417a7fb856f08a1305b9dc0b3e580d76f833a (diff) | |
download | system_core-47dc236d2f3227b4d952ad490939f7c9b0f8c90b.tar.gz system_core-47dc236d2f3227b4d952ad490939f7c9b0f8c90b.tar.bz2 system_core-47dc236d2f3227b4d952ad490939f7c9b0f8c90b.zip |
Set reserved GID when setting reserved blocks.
If we're setting up the number of reserved blocks, we also want to
set our new AID_DISK_RESERVED as the GID that's allowed to use those
blocks.
Test: builds, boots
Bug: 62024591
Change-Id: Iaabfa7d63ad9ff0b9732e2b9996937607d622fe2
Diffstat (limited to 'fs_mgr')
-rw-r--r-- | fs_mgr/fs_mgr.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index 4b94f9c97..a2b80ad9f 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -38,6 +38,7 @@ #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/unique_fd.h> +#include <cutils/android_filesystem_config.h> #include <cutils/android_reboot.h> #include <cutils/partition_utils.h> #include <cutils/properties.h> @@ -353,7 +354,7 @@ static void tune_reserved_size(const char* blk_device, const struct fstab_rec* r reserved_blocks = max_reserved_blocks; } - if (ext4_r_blocks_count(sb) == reserved_blocks) { + if ((ext4_r_blocks_count(sb) == reserved_blocks) && (sb->s_def_resgid == AID_RESERVED_DISK)) { return; } @@ -363,11 +364,12 @@ static void tune_reserved_size(const char* blk_device, const struct fstab_rec* r return; } - char buf[32]; - const char* argv[] = {TUNE2FS_BIN, "-r", buf, blk_device}; - - snprintf(buf, sizeof(buf), "%" PRIu64, reserved_blocks); LINFO << "Setting reserved block count on " << blk_device << " to " << reserved_blocks; + + auto reserved_blocks_str = std::to_string(reserved_blocks); + auto reserved_gid_str = std::to_string(AID_RESERVED_DISK); + const char* argv[] = { + TUNE2FS_BIN, "-r", reserved_blocks_str.c_str(), "-g", reserved_gid_str.c_str(), blk_device}; if (!run_tune2fs(argv, ARRAY_SIZE(argv))) { LERROR << "Failed to run " TUNE2FS_BIN " to set the number of reserved blocks on " << blk_device; |