mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Brown <neilb@cse.unsw.edu.au>
To: Christoph Hellwig <hch@infradead.org>
Cc: Linus Torvalds <torvalds@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2 of 2 - Allow O_EXCL on a block device to claim exclusive use.
Date: Tue, 12 Aug 2003 11:48:28 +1000	[thread overview]
Message-ID: <16184.18284.969212.342794@gargle.gargle.HOWL> (raw)
In-Reply-To: message from Christoph Hellwig on Monday August 11

On Monday August 11, hch@infradead.org wrote:
> On Mon, Aug 11, 2003 at 12:35:57PM +1000, NeilBrown wrote:
> > diff ./fs/block_dev.c~current~ ./fs/block_dev.c
> > -	return do_open(bdev, inode, filp);
> > +	res = do_open(bdev, inode, filp);
> > +	if (res)
> > +		return res;
> > +
> > +	if (!(filp->f_flags & O_EXCL) )
> > +		return 0;
> > +
> > +	if (!(res = bd_claim(bdev, filp)))
> > +		return 0;
> > +
> > +	blkdev_put(bdev, BDEV_FILE);
> > +	return res;
> 
> Shouldn't you claim it before opening.  Also what is the desired
> behaviour when opening partitions vs whole device with O_EXCL?

Good question.
My first attempt at this did claim before openning.
However that didn't work.
Some aspects of the bdev that are needed for claiming are not
initialised before it is first opened.  In particular, bd_contains,
gets set up by do_open.

Also, other code uses this order.
e.g. open_bdev_excl called blkdev_get (which calls do_open) before
bd_claim.

NeilBrown

  reply	other threads:[~2003-08-12  1:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-11  2:35 NeilBrown
2003-08-11  7:22 ` Christoph Hellwig
2003-08-12  1:48   ` Neil Brown [this message]
2003-08-12  2:56     ` Andries Brouwer
2003-08-12  3:06       ` viro

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=16184.18284.969212.342794@gargle.gargle.HOWL \
    --to=neilb@cse.unsw.edu.au \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®