Skip to content

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

@osmithde

Description

@osmithde

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions