mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: NeilBrown <neilb@cse.unsw.edu.au>
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: Mon, 11 Aug 2003 08:22:31 +0100	[thread overview]
Message-ID: <20030811082231.A20077@infradead.org> (raw)
In-Reply-To: <E19m2XN-0002BU-00@notabene>; from neilb@cse.unsw.edu.au on Mon, Aug 11, 2003 at 12:35:57PM +1000

On Mon, Aug 11, 2003 at 12:35:57PM +1000, NeilBrown wrote:
> diff ./fs/block_dev.c~current~ ./fs/block_dev.c
> --- ./fs/block_dev.c~current~	2003-08-11 09:01:38.000000000 +1000
> +++ ./fs/block_dev.c	2003-08-11 09:01:41.000000000 +1000
> @@ -643,6 +643,7 @@ int blkdev_get(struct block_device *bdev
>  int blkdev_open(struct inode * inode, struct file * filp)
>  {
>  	struct block_device *bdev;
> +	int res;
>  
>  	/*
>  	 * Preserve backwards compatibility and allow large file access
> @@ -655,7 +656,18 @@ int blkdev_open(struct inode * inode, st
>  	bd_acquire(inode);
>  	bdev = inode->i_bdev;
>  
> -	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?


  reply	other threads:[~2003-08-11  7:22 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 [this message]
2003-08-12  1:48   ` Neil Brown
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=20030811082231.A20077@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    --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®