pdata.bdev, pdata.result);
if (pdata.op == BLOCK_DEV_MOUNT && pdata.result < 0) {
- ret = change_mount_point(pdata.bdev, "");
- if (ret < 0)
- goto out;
-
- /* Modify /run/external-storage/id file */
- create_file(pdata.bdev->data->id, pdata.bdev->data->mount_point);
+ if (pdata.bdev->data->state == BLOCK_UNMOUNT) {
+ ret = change_mount_point(pdata.bdev, "");
+ /* Modify /run/external-storage/id file */
+ if (ret == 0)
+ create_file(pdata.bdev->data->id, pdata.bdev->data->mount_point);
+ }
+ goto out;
}
/* Broadcast to mmc and usb storage module */
DBusError err;
struct block_data *data;
int r;
+ int ret;
bool ret_val;
assert(bdev);
data->state = BLOCK_MOUNT;
- r = app2ext_migrate_legacy_all();
- if (r < 0)
+ ret = app2ext_migrate_legacy_all();
+ if (ret < 0)
_E("app2ext failed");
msg = dbus_method_sync_with_reply(PKGDIR_BUS_NAME, PKGDIR_PATH,
dbus_error_init(&err);
- r = dbus_message_get_args(msg, &err, DBUS_TYPE_BOOLEAN, &ret_val, DBUS_TYPE_INVALID);
- if (!r) {
+ ret = dbus_message_get_args(msg, &err, DBUS_TYPE_BOOLEAN, &ret_val, DBUS_TYPE_INVALID);
+ if (!ret) {
_E("no message : [%s:%s]", err.name, err.message);
dbus_error_free(&err);
}
out:
+ if (r < 0 && r != -EROFS)
+ data->state = BLOCK_UNMOUNT;
+
_I("%s result : %s, %d", __func__, data->devnode, r);
if (pipe_trigger(BLOCK_DEV_MOUNT, bdev, r) < 0)
r = mount_start(bdev);
if (r < 0) {
- _E("Failed to mount (%d)", data->devnode);
+ _E("Failed to mount (%s)", data->devnode);
return r;
}
r = mmc_check_and_unmount(data->mount_point);
if (!r) {
- _D("Success to unmount (%d)", data->mount_point);
+ _D("Success to unmount (%s)", data->mount_point);
break;
}
}