Messages in this thread | | | Date | Thu, 11 Nov 2004 19:26:31 +0200 | From | Alexander Sandler <> | Subject | exclusive access with bd_claim |
| |
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. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |