{
struct block_data *data;
int r, retry = 0;
- struct timespec time = {0,};
if (!bdev || !bdev->data || !bdev->data->mount_point)
return -EINVAL;
if ((data->block_type == BLOCK_MMC_DEV ||
data->block_type == BLOCK_EXTENDEDSD_DEV) &&
data->primary) {
- /* At first, notify to other app
- * who already access sdcard */
+ /* At first, notify to other app who already access sdcard */
_I("Notify to other app who already access sdcard.");
vconf_set_int(VCONFKEY_SYSMAN_MMC_STATUS,
VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED);
+
+ /* Wait for 700 msec to release open files */
+ usleep(700 * 1000);
}
sync();
+
if (umount2(data->mount_point, MNT_DETACH) != 0) {
_I("Failed to unmount with lazy option: %m");
return -errno;
}
- time.tv_nsec = 500 * NANO_SECOND_MULTIPLIER;
-
while (retry++ < UNMOUNT_RETRY) {
_I("Kill app with SIGTERM.");
terminate_process(data->devnode, false);
- nanosleep(&time, NULL);
+ usleep(500 * 1000);
+
+ if (!is_in_use_partition(data->devnode))
+ break;
_I("Kill app with SIGKILL.");
terminate_process(data->devnode, true);
- nanosleep(&time, NULL);
+ usleep(500 * 1000);
if (!is_in_use_partition(data->devnode))
break;
}
+
sync();
out: