@@ -771,6 +771,8 @@ struct kvm {
struct notifier_block pm_notifier;
#endif
char stats_id[KVM_STATS_NAME_SIZE];
+
+ struct delayed_work run_after_vm_release_work;
};
#define kvm_err(fmt, ...) \
@@ -1258,12 +1258,25 @@ void kvm_put_kvm_no_destroy(struct kvm *kvm)
}
EXPORT_SYMBOL_GPL(kvm_put_kvm_no_destroy);
+static void run_after_vm_release(struct work_struct *work)
+{
+ struct delayed_work *dwork = to_delayed_work(work);
+ struct kvm *kvm = container_of(dwork, struct kvm, run_after_vm_release_work);
+
+ pr_info("I'm still alive!\n");
+ kvm_put_kvm(kvm);
+}
+
static int kvm_vm_release(struct inode *inode, struct file *filp)
{
struct kvm *kvm = filp->private_data;
kvm_irqfd_release(kvm);
+ kvm_get_kvm(kvm);
+ INIT_DELAYED_WORK(&kvm->run_after_vm_release_work, run_after_vm_release);
+ schedule_delayed_work(&kvm->run_after_vm_release_work, 10 * HZ);
+
kvm_put_kvm(kvm);
return 0;
}