Ramdisk driver module

From: Alex Buell
Date: Wed Mar 04 2009 - 05:19:46 EST


Folks,

I've just put together a ramdisk driver module over the last few days
adapted from bits that I've gleaned on the 'net. However, I have found
a problem with the module that I've not been able to solve yet. When
loading it for the first time, it all works perfectly, I can create a
filesystem on the devices, copy files onto it, then unload it
perfectly.

The problem arises when I reload the module, it crashes with 'badness
at fs/sysfs/dir.c:463' on my G3 iMac PPC machine which I use as a
generic kernel development machine, this runs 2.6.27.

There's this line:
'kobject_add_internal failed for 252:0 with -EEXIST, don't try to
register things with the same name in the same directory.'

252:0 is the dynamically assigned device major-minor number which is
correct. The odd thing when looking over the code in unload.c where it
unregisters the device it appears to work just fine. And I look at
the /dev/* directory and the device name definitely disappears when
unloaded. Yet when I reload the module it crashes with the above error.

Any ideas why? I've bzipped up the sources and uploaded it to
http://www.munted.org.uk/programming/ramdisk.tar.bz2

Also, I'd appreciate some constructive advice on improving on my work
further.

The original reason why I wrote this ramdisk was that I intended to use
variable sector sizes with it so I could test filesystems with it, as I
see that devices with 4k sectors could be on the market soon.

Thanks
Alex
--
http://www.munted.org.uk

Fearsome grindings.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/