Merge "sdcard: ensure installd fs upgrade has completed"
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index 64ca4b3..e413596 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -1850,6 +1850,7 @@
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 @@
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;
}