From: Xiaobo Chi Date: Wed, 11 Nov 2015 06:57:23 +0000 (+0800) Subject: vhost: fix kernel module insertion X-Git-Tag: spdx-start~7977 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7836894a641d3befe5c5c8e75f31f84ce4e9b4b2;p=dpdk.git vhost: fix kernel module insertion Problem:if I firstly insert my kmod_test.ko, then insert eventfd_link.ko, error will happen with hint "Device or resource busy". This is because the default minor device number, 0, has been occupied by my kmod_test.ko . root@distro:~/test$ lsmod Module Size Used by kmod_test 927 0 vboxsf 35930 4 vboxguest 222130 1 vboxsf microcode 10315 0 autofs4 25051 0 root@distro:~/test$ insmod ./eventfd_link.ko insmod: ERROR: could not insert module ./eventfd_link.ko: Device or resource busy Explanation: For miscdevices, the major device_no is same, so the minor device_no should be set to ditinguish different misc devices; if not set the minor, it may fail while insmod due to the default minor value, 0, has been used by other miscdevice. MISC_DYNAMIC_MINOR means to let Linux kernel dynamically assign one minor devide number while loading. Signed-off-by: Xiaobo Chi Acked-by: Yuanhan Liu --- diff --git a/lib/librte_vhost/eventfd_link/eventfd_link.c b/lib/librte_vhost/eventfd_link/eventfd_link.c index c54a938d32..4b05b5a8e5 100644 --- a/lib/librte_vhost/eventfd_link/eventfd_link.c +++ b/lib/librte_vhost/eventfd_link/eventfd_link.c @@ -249,6 +249,7 @@ static const struct file_operations eventfd_link_fops = { static struct miscdevice eventfd_link_misc = { + .minor = MISC_DYNAMIC_MINOR, .name = "eventfd-link", .fops = &eventfd_link_fops, };