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

fix "module in use error" when rmmod #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/redirfs/rfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,13 @@ static int __init rfs_init(void)
return rv;
}

void rfs_exit(void) {
extern int rfs_sysfs_remove(void);
rfs_sysfs_remove();
}

module_init(rfs_init);
module_exit(rfs_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Frantisek Hrbata <frantisek.hrbata@redirfs.org>");
Expand Down
16 changes: 16 additions & 0 deletions src/redirfs/rfs_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,22 @@ void rfs_flt_sysfs_exit(struct rfs_flt *rflt)
kobject_del(&rflt->kobj);
}

int rfs_sysfs_remove(void)
{
sysfs_remove_file(rfs_info_kobj, &stat_attr.attr);

if (rfs_info_kobj)
kobject_put(rfs_info_kobj);

if (rfs_flt_kset)
kobject_put(&rfs_flt_kset->kobj);

if (rfs_kobj)
kobject_put(rfs_kobj);

return 0;
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))

extern ssize_t rfs_get_stat(char *buf, ssize_t size);
Expand Down