Merge "Don't abort the encryption process if an internal volume is present but unmounted."

gugelfrei
Ken Sumrall 13 years ago committed by Android (Google) Code Review
commit 86bccb14d6

@ -589,7 +589,7 @@ int Volume::unmountVol(bool force) {
if (getState() != Volume::State_Mounted) {
SLOGE("Volume %s unmount request when not mounted", getLabel());
errno = EINVAL;
return -1;
return UNMOUNT_NOT_MOUNTED_ERR;
}
setState(Volume::State_Unmounting);

@ -1192,7 +1192,7 @@ int VolumeManager::unmountVolume(const char *label, bool force) {
SLOGW("Attempt to unmount volume which isn't mounted (%d)\n",
v->getState());
errno = EBUSY;
return -1;
return UNMOUNT_NOT_MOUNTED_ERR;
}
cleanupAsec(v, force);

@ -137,6 +137,7 @@ private:
extern "C" {
#endif /* __cplusplus */
#define UNMOUNT_NOT_MOUNTED_ERR -2
int vold_unmountVol(const char *label);
int vold_getNumDirectVolumes(void);
int vold_getDirectVolumeList(struct volume_info *v);

@ -1062,7 +1062,7 @@ int cryptfs_enable(char *howarg, char *passwd)
unsigned long mnt_flags, nr_sec;
unsigned char master_key[KEY_LEN_BYTES], decrypted_master_key[KEY_LEN_BYTES];
unsigned char salt[SALT_LEN];
int rc=-1, fd, i;
int rc=-1, fd, i, ret;
struct crypt_mnt_ftr crypt_ftr, sd_crypt_ftr;;
char tmpfs_options[PROPERTY_VALUE_MAX];
char encrypted_state[PROPERTY_VALUE_MAX];
@ -1141,7 +1141,10 @@ int cryptfs_enable(char *howarg, char *passwd)
}
close(fd);
if (vold_unmountVol(vol_list[i].label)) {
ret=vold_unmountVol(vol_list[i].label);
if ((ret < 0) && (ret != UNMOUNT_NOT_MOUNTED_ERR)) {
/* -2 is returned when the device exists but is not currently mounted.
* ignore the error and continue. */
SLOGE("Failed to unmount volume %s\n", vol_list[i].label);
goto error_unencrypted;
}

Loading…
Cancel
Save