mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Andrey Borzenkov <arvidjaar@mail.ru>
Cc: linux-kernel@vger.kernel.org
Subject: Re: True number of device openers in 2.5
Date: Thu, 12 Jun 2003 17:37:24 +0100	[thread overview]
Message-ID: <20030612163724.GL6754@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <200306121937.53198.arvidjaar@mail.ru>

On Thu, Jun 12, 2003 at 07:37:53PM +0400, Andrey Borzenkov wrote:
> For single-partition devices it is just bd_openers but I am more intersted in 
> multi-partition case. Here I need to know about sum of opens for all 
> partitions including the whole device. It appears that for a container 
> bd_openers is incremented for every open of itself and for the _first_ open 
> of partition and bd_part_count is incremented for every (including first) 
> open of partition. So bdev->bd_contains->bd_openers + 
> bdev->bd_contains->bd_part_count really gives an access (number of opened 
> partitions but this is unknown otherwise).

There is no way to get anything useful out of that.  _Any_ kernel code
that relies on such counters to tell if there's somebody else who might've
accessed the thing does not account for the fact that fork() and dup()
do not go beyond the struct file.

IOW, any place that does
	if (number of openers == 1)
		do something that breaks if IO is going on
is FUBAR.  Variant with
	if (number of openers == 0)
		block ->open()
		do something ...
will work, but it means that we are not triggering it from ioctl() on that
device.  And here we only care about zero/non-zero, so ->bd_openers on
the entire disk will do just fine.

  reply	other threads:[~2003-06-12 16:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-12 15:37 Andrey Borzenkov
2003-06-12 16:37 ` viro [this message]
2003-06-17 18:18   ` Andrey Borzenkov

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=20030612163724.GL6754@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=arvidjaar@mail.ru \
    --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

all inboxes | Powered by JetHome®