* exclusive access with bd_claim
@ 2004-11-11 17:26 Alexander Sandler
0 siblings, 0 replies; only message in thread
From: Alexander Sandler @ 2004-11-11 17:26 UTC (permalink / raw)
To: linux-kernel
I encountered this when tried to get exclusive access to device with
bd_claim(). Following code, when compiled as loaded as module, does
not prevent from modifying partition table on /dev/sda.
----------------------------------------------
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/blkdev.h>
struct block_device *bdev;
int excl_init( void )
{
bdev = open_bdev_excl( "/dev/sda", 0, THIS_MODULE );
if (!bdev)
printk( "failed to open /dev/sda\n" );
return 0;
}
void excl_exit( void )
{
if (bdev)
close_bdev_excl( bdev );
}
module_init( excl_init );
module_exit( excl_exit );
----------------------------------------------
Same when doing
bdev = open_by_devnum( MKDEV( 8, 0 ), FMODE_READ | FMODE_WRITE );
if (bdev)
bd_claim( bdev, THIS_MODULE );
instead of open_bdev_excl(...).
Am I missing something? Any ideas?
system: SLES8 + 2.6.9 on MP machine.
--
Sasha.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-11-11 17:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-11 17:26 exclusive access with bd_claim Alexander Sandler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome