linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Vlasov <vsu@altlinux.ru>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Roderich.Schupp.extern@mch.siemens.de,
	linux-kernel@vger.kernel.org,
	linux-hotplug-devel@lists.sourceforge.net
Subject: Re: Race between "mount" uevent and /proc/mounts?
Date: Wed, 26 Oct 2005 10:27:10 +0000	[thread overview]
Message-ID: <20051026142710.1c3fa2da.vsu@altlinux.ru> (raw)
In-Reply-To: <20051025140041.GO7992@ftp.linux.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1991 bytes --]

(sorry for the broken message sent yesterday)

On Tue, 25 Oct 2005 15:00:41 +0100 Al Viro wrote:

> On Tue, Oct 25, 2005 at 03:20:10PM +0200, Schupp Roderich (extern) BenQ MD PD SWP 2 CM MCH wrote:
> > the 2.6.13 and 2.6.14-* kernels seem susceptible to a race condition
> > between the sending of a "mount" uevent and the actual mount becoming
> > visible thru /proc/mounts, at least when the kernel is configured
> > with voluntary preemption. 

The "umount" uevent has the same problem - the event is emitted at the
start of umount process, but the umount can really complete much later
(e.g., if there was a lot of cached writes).  This is really bad,
because the "umount" uevent cannot be used to tell the user when it is
safe to remove the device.

> > The following scenario: 
> > - system is using the HAL daemon, configured to monitor kernel uvents
> > - someone (usually some kind of volume manager in response to
> >   a device hotplug, but could also a manual mount) mounts a filesystem
> > - "mount" uevent is emitted
> 
> ... said event happens to be a piece of junk with ill-defined semantics.

Hmm, and what should be the proper semantics for such an event?

Currently the "mount" uevent signals that the device is busy (and the
"umount" uevent then should signal that the device is no longer in use,
but that is currently broken).

> > - HAL daemon reads the event, then opens and reads /proc/mounts
> 
> real useful, since
> 	a) we have no idea if mount() is being done in the same namespace
> 	b) we have no idea if mount() actually succeeds
> 	c) even if we manage to find a mountpoint, we have no idea if it
> gets e.g. mount --move just as we'd finished reading from /prov/mounts
> 	d) if the goal is to see which devices are held by mounted fs,
> you'll miss such things as e.g. external journals.
> 
> >   (in order to determine the corresponding mount point, since the uevent
> 
> *the* corresponding mountpoint?  Which one?  There might be any number
> of those...

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

       reply	other threads:[~2005-10-26 10:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0AD07C7729CA42458B22AFA9C72E7011C8EF@mhha22kc.mchh.siemens.de>
     [not found] ` <20051025140041.GO7992@ftp.linux.org.uk>
2005-10-26 10:27   ` Sergey Vlasov [this message]
2005-10-26 11:15     ` Race between "mount" uevent and /proc/mounts? Al Viro
2005-10-26 14:34       ` Kay Sievers
2005-10-26 14:45         ` Xavier Bestel
2005-10-26 19:28         ` Al Viro
2005-11-01  0:28           ` Kay Sievers
2005-11-01  3:58             ` Kay Sievers
2005-11-01 19:54               ` Sergey Vlasov
2005-11-01 21:35                 ` Kay Sievers
2005-11-02 13:01                   ` Sergey Vlasov
2005-11-03  8:07                     ` Al Viro
2005-11-03 10:52                       ` Sergey Vlasov
2005-11-03 11:30                         ` Al 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=20051026142710.1c3fa2da.vsu@altlinux.ru \
    --to=vsu@altlinux.ru \
    --cc=Roderich.Schupp.extern@mch.siemens.de \
    --cc=linux-hotplug-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).