summaryrefslogtreecommitdiffstats
path: root/sdcard
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2014-07-24 17:05:59 -0700
committerNick Kralevich <nnk@google.com>2014-07-25 09:44:29 -0700
commit506edb5f7ca1cc6e26cd136177d37cbd5c66a1e1 (patch)
treee14acf0087e85ad11ba6163ac39b913872576c5a /sdcard
parente91d9d80d18eca571f00c82b54cd44956299cbda (diff)
downloadsystem_core-506edb5f7ca1cc6e26cd136177d37cbd5c66a1e1.tar.gz
system_core-506edb5f7ca1cc6e26cd136177d37cbd5c66a1e1.tar.bz2
system_core-506edb5f7ca1cc6e26cd136177d37cbd5c66a1e1.zip
sdcard: ensure installd fs upgrade has completed
Before running the sdcard daemon, make sure that installd has completed all upgrades to /data that it needs to complete. This avoids race conditions between installd and the sdcard daemon. Maybe fixes bug 16329437. (cherrypicked from commit 8d28fa71fce6a5623488614250970ce78551a924) Bug: 16329437 Change-Id: I5e164f08009c1036469f8734ec07cbae9c5e262b
Diffstat (limited to 'sdcard')
-rw-r--r--sdcard/sdcard.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index 64ca4b342..e41359653 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -1850,6 +1850,7 @@ int main(int argc, char **argv)
bool split_perms = false;
int i;
struct rlimit rlim;
+ int fs_version;
int opt;
while ((opt = getopt(argc, argv, "u:g:w:t:dls")) != -1) {
@@ -1924,6 +1925,11 @@ int main(int argc, char **argv)
ERROR("Error setting RLIMIT_NOFILE, errno = %d\n", errno);
}
+ while ((fs_read_atomic_int("/data/.layout_version", &fs_version) == -1) || (fs_version < 3)) {
+ ERROR("installd fs upgrade not yet complete. Waiting...\n");
+ sleep(1);
+ }
+
res = run(source_path, dest_path, uid, gid, write_gid, num_threads, derive, split_perms);
return res < 0 ? 1 : 0;
}