Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dba750e0 authored by Wei Wang's avatar Wei Wang
Browse files

Make sure wait for the dm device

Bug: 32408249
Test: on m/s
Change-Id: I65fa4fec94c82ef51d2c8d0aabf9e90b8448f27f
parent 0ca2fe4c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -341,6 +341,17 @@ static int resume_verity_table(struct dm_ioctl *io, char *name, int fd)
    return 0;
}

static int test_access(char *device) {
    int tries = 25;
    while (tries--) {
        if (!access(device, F_OK) || errno != ENOENT) {
            return 0;
        }
        usleep(40 * 1000);
    }
    return -1;
}

static int check_verity_restart(const char *fname)
{
    char buffer[VERITY_KMSG_BUFSIZE + 1];
@@ -1020,6 +1031,11 @@ loaded:
    fstab->blk_device = verity_blk_name;
    verity_blk_name = 0;

    // make sure we've set everything up properly
    if (test_access(fstab->blk_device) < 0) {
        goto out;
    }

    retval = FS_MGR_SETUP_VERITY_SUCCESS;

out: