Re: Module unload fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Adil,

On Wed, Oct 6, 2010 at 5:30 AM, Adil Mujeeb <mujeeb.adil@xxxxxxxxx> wrote:
> Hi list,
>
> I am trying to create a dummy module for learning purpose. For “hello
> world” example, everything goes fine. But when I tried to add
> register_filesystem and unregister_filesystem call the behavior is
> unexpected. I am not able to unload my module.
>
> My module has single file named rkfs_mod.c:
>
> [adil@tom kernel]$ cat rkfs_mod.c
> #include <linux/module.h>
> #include <linux/fs.h>
>
> static struct super_block *rkfs_get_sb(struct file_system_type *fs_type,
>                int flags, char *dev_name, void *raw_data)
> {
>        printk("get_sb call\n");
>        return NULL;
> }
>
> static void rkfs_kill_sb(struct super_block *s)
> {
>        printk("kill sb \n");
>        return;
> }
>
> static struct file_system_type rkfs = {
>    name:               "rkfs_mod",
>    get_sb:     rkfs_get_sb,
>    kill_sb:    rkfs_kill_sb,
>    owner:              THIS_MODULE
> };
>
> int init_module(void) {
>    int err;
>        printk("Registering the filesystem\n");
>        err = register_filesystem( &rkfs );
>    return err;
> }
>
> void exit_module(void){
>        printk("Unregisterign the filesystem\n");
>        unregister_filesystem(&rkfs);
> }
> [adil@tom kernel]$
>
> My Makefile contents:
>
> [adil@tom kernel]$ cat Makefile
> obj-m += rkfs_mod.o
> all:
>        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
> clean :
>        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
> [adil@tom kernel]$
>
> [adil@tom kernel]$ uname -a
> Linux tom.HCLTECH 2.6.30 #1 SMP Thu Dec 17 16:45:24 IST 2009 i686 i686
> i386 GNU/Linux
> [adil@tom kernel]$
>
> Module loading is successful but unloading fails.
>
> [root@tom linux-2.6.30]# /sbin/lsmod | grep rkfs
> rkfs_mod                1452  0 [permanent]

The [permanent] tag indicates that the module has no module_exit, and
thus can't be unloaded.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux