[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201222145221.711-11-xieyongji@bytedance.com>
Date: Tue, 22 Dec 2020 22:52:18 +0800
From: Xie Yongji <xieyongji@...edance.com>
To: mst@...hat.com, jasowang@...hat.com, stefanha@...hat.com,
sgarzare@...hat.com, parav@...dia.com, akpm@...ux-foundation.org,
rdunlap@...radead.org, willy@...radead.org,
viro@...iv.linux.org.uk, axboe@...nel.dk, bcrl@...ck.org,
corbet@....net
Cc: virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
kvm@...r.kernel.org, linux-aio@...ck.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org
Subject: [RFC v2 10/13] vduse: grab the module's references until there is no vduse device
The module should not be unloaded if any vduse device exists.
So increase the module's reference count when creating vduse
device. And the reference count is kept until the device is
destroyed.
Signed-off-by: Xie Yongji <xieyongji@...edance.com>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index d24aaacb6008..c29b24a7e7e9 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -1052,6 +1052,7 @@ static int vduse_destroy_dev(u32 id)
kfree(dev->vqs);
vduse_iova_domain_destroy(dev->domain);
vduse_dev_destroy(dev);
+ module_put(THIS_MODULE);
return 0;
}
@@ -1096,6 +1097,7 @@ static int vduse_create_dev(struct vduse_dev_config *config)
refcount_inc(&dev->refcnt);
list_add(&dev->list, &vduse_devs);
+ __module_get(THIS_MODULE);
return fd;
err_fd:
--
2.11.0
Powered by blists - more mailing lists