public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lars Ellenberg <l.g.e@web.de>
To: linux-kernel@vger.kernel.org
Subject: Re: stacked bdev driver, howto? locking of lower level block device
Date: Wed, 7 Aug 2002 22:55:42 +0200	[thread overview]
Message-ID: <20020807205542.GA2359@johann> (raw)
In-Reply-To: <20020807105059.A18751@vato.org> <200208060542.g765gc856679@sullivan.realtime.net> <20020805221652.A4250@johann>


ok, I got some answers. not that much though.

On Mon, Aug 05, 2002 at 10:16:52PM +0200, I wrote:
> I'd like to implement some kind of locking of the lower level
> block device, so nobody can mount it/modify it underneath the drbd
> driver.
> 
> I know drivers/md/md.c does this somehow. I tried to understand
> and adapt, but it does not work.
to be more explicit:
/*
 * prevent the device from being mounted, repartitioned or
 * otherwise reused by a RAID array (or any other kernel
 * subsystem), by opening the device. [simply getting an
 * inode is not enough, the SCSI module usage code needs
 * an explicit open() on the device]
 */
static int lock_rdev(mdk_rdev_t *rdev)

but this does _not_ prevent the device from being mounted or used, I
did not check the repartitioning.

On Tue, Aug 06, 2002 at 12:42:38AM -0500, Milton Miller suggested:
>> In 2.5 see bd_claim and bd_release in fs/block_dev.c
well, I need to have this on 2.4 for now. I did not check the 2.5 code
yet. other opinions whether this will work when we swithc to 2.5?

>> In 2.4 as fars as I know you have to add yourself to the list of checks
>> that are incomplete and don't all check against each other (swap,
>> filesystems, raid, etc).
could someone be so kind an be more explicit please.
what piece of code do "list of checks" translate to?

or do I have to follow this?
On Wed, Aug 07, 2002 at 10:51:00AM -0700, Tim Pepper had the impression:
>> this is not possible from what I've seen inside the kernel.  You can
>> do a bdget/blkdev_get() on teh underlying dev, but as far as I saw
>> that only prevents somebody from fdisking the device.
>> 
>> I think a lot of people figure this is just in line with the unix way
>> of allowing you to shoot yourself in the foot if you want.  I don't
>> have a big problem with that, but understand the arguments to the
>> contrary.
is this the case? it is not possible?
I understand that all this is not that important, but I want do do it
anyways, to reduce the careless foot shooter. I suppose, iff someone
really wants to, the shooting can be done with raw io anyways.
no problem, then every now and then someone will have to do some
transplantation...

BTW: why can I mount just about every device multiple times on different
     mountpoints at the same time?

ok, my questions remain:
> 
> - How does block device locking work?
> - In which mode do I have to open it?
> - Which flags have to be set?
> - What else am I missing?

Thanks.
	Lars-Gunnar

      reply	other threads:[~2002-08-08  4:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20020807105059.A18751@vato.org>
     [not found] ` <200208060542.g765gc856679@sullivan.realtime.net>
2002-08-05 20:16   ` stacked bdev driver, howto? locking of lower level block device Lars Ellenberg
2002-08-07 20:55     ` Lars Ellenberg [this message]

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=20020807205542.GA2359@johann \
    --to=l.g.e@web.de \
    --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