Linux driver load/unload: holder vs. refcnt
by gglq000 from LinuxQuestions.org on (#6F53S)
I had trouble unloading driver even though no one using and refused to unload right after load:
modprobe: OK
modprobe -r: "error: driver in use" error.
Same for rmmod. even with force.
It turns out modprobe and rmmod, lsmods are part of kmod package which its source, I was able to download and customize and build.
It turns out during rmmod event, two checks are made: driver's refcnt and holders. The refusal to unload is due to refcnt > 0 even though its holders are returning NULL. I am not sure if refcnt > 0 and holders = NULL are error or invalid event. I do see sevreal other drivers do that.
When I try chasing how refcnt is returning non-zero, it leads to delete_module() API which is no longer part of kmod and can not find its source in linux kernel as well.
Does anyone have idea about how i can proceed to successful unload driver?
modprobe: OK
modprobe -r: "error: driver in use" error.
Same for rmmod. even with force.
It turns out modprobe and rmmod, lsmods are part of kmod package which its source, I was able to download and customize and build.
It turns out during rmmod event, two checks are made: driver's refcnt and holders. The refusal to unload is due to refcnt > 0 even though its holders are returning NULL. I am not sure if refcnt > 0 and holders = NULL are error or invalid event. I do see sevreal other drivers do that.
When I try chasing how refcnt is returning non-zero, it leads to delete_module() API which is no longer part of kmod and can not find its source in linux kernel as well.
Does anyone have idea about how i can proceed to successful unload driver?