From: Alexander Sandler <alexander.sandler@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: exclusive access with bd_claim
Date: Thu, 11 Nov 2004 19:26:31 +0200 [thread overview]
Message-ID: <230a243e0411110926225028a7@mail.gmail.com> (raw)
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.
reply other threads:[~2004-11-11 17:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=230a243e0411110926225028a7@mail.gmail.com \
--to=alexander.sandler@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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