lkml.org 
[lkml]   [2004]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectexclusive 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/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.024 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site