Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Targetcli/rtslib get module reference, but don't drop it #114

Closed
osmithde opened this issue Apr 25, 2018 · 2 comments
Closed

Targetcli/rtslib get module reference, but don't drop it #114

osmithde opened this issue Apr 25, 2018 · 2 comments

Comments

@osmithde
Copy link

Hi,
I am writing a fabric module for use with targetcli-fb and rtslib-fb. Currently, all functionality is there, but I have one issue that I wanted to discuss with the community to see if I need to change my code or if it is a targetcli/rtslib bug. Here is a link to the PR showing my changes to rtslib-fb to include the fabric module: open-iscsi/rtslib-fb#129. The issue I have is that once I create a target within targetcli, I cannot unregister my kernel module, even after I delete everything in targetcli. The module's ref count will increase with the number of objects I make in targetcli, obviously, and it will decrease when I delete them. But when I clearconfig, I am always left with one reference to my kernel module. Furthermore, if I do not create any targets in targetcli, (so my ref count starts at 0), but just try to create a target with a bad WWN (for example 0), I gain a reference to my kernel module that doesn't go away. Even though nothing was created in targetcli. After dumping the stack to see where the module_get was coming from, I see that it is coming form configfs_mkdir. So my best reasoning is that /sys/kernel/config/target/my_module gets created, which holds a reference to my module. Is there a canonical way to drop this reference? Should I be calling something differently? Or is this a targetcli/rtslib or configfs bug?
If anyone can help, I would be greatly appreciative.
Thanks,
Oliver

@osmithde
Copy link
Author

However, if I rmdir /sys/kernel/config/target/my_module then the kernel reference gets dropped. So maybe this isn't a targetcli issue, unless you think that you should be able to drop the configfs directory from within targetcli. Say if all targets in a module get dropped. But I am satisfied that there is a way to unload my module, so I leave that up to your judgement and feel free to close this issue. Thank you.

@agrover
Copy link
Contributor

agrover commented Apr 30, 2018

Closing for now.

@agrover agrover closed this as completed Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants