From: Daniel Lezcano <daniel.lezcano@free.fr>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Chris Friesen <cfriesen@nortel.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: mount notification question
Date: Fri, 06 Aug 2010 10:05:06 +0200 [thread overview]
Message-ID: <4C5BC232.1030304@free.fr> (raw)
In-Reply-To: <AANLkTi=h633N2toWEHqwubVf8Hd21==+4Or7h=35d+Kr@mail.gmail.com>
On 08/06/2010 09:44 AM, Kay Sievers wrote:
> On Fri, Aug 6, 2010 at 03:07, Daniel Lezcano<daniel.lezcano@free.fr> wrote:
>
>> On 08/04/2010 08:41 PM, Chris Friesen wrote:
>>
>>> On 08/02/2010 03:12 PM, Daniel Lezcano wrote:
>>>
>>>> is there a way to be notified when a mount occurs on the system ?
>>>>
>>> Have you looked on google? The link is a bit misleading but they do
>>> give a way to do it (not using inotify).
>>>
>>> http://stackoverflow.com/questions/1113176/how-could-i-detect-when-a-directory-is-mounted-with-inotify
>>>
>> Thanks a lot for the pointer. I am not sure this solution will work, because
>> it is inadequate for watching a specific location in a container context
>> separated by the mount and the network namespaces. We have multiple mount
>> points at the same place (eg. the mount point inheritance, the container
>> configuration and the init scripts may mount /dev or /var/run several time)
>> and the network namespace separation will make impossible to watch udev
>> event via a netlink socket. I didn't look at the inotify implementation but
>> IMHO, it should be worth to add IN_MOUNT and IN_UNMOUNT events for inotify
>> no ?
>>
> These events wouldn't work, and they are long removed from the kernel
> and don't exist.
>
> You need to poll() /proc/mounts, and any changes in it will wake you
> up with POLL_ERR. /proc/mounts should be namespace aware.
>
Ah, great ! I will look for this solution (I suppose I will probably
have to diff /proc/mounts but anyway ...)
Thanks Kay and Chris for your help.
-- Daniel
prev parent reply other threads:[~2010-08-06 8:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-02 21:12 mount notification question Daniel Lezcano
2010-08-04 18:41 ` Chris Friesen
2010-08-06 1:07 ` Daniel Lezcano
2010-08-06 7:44 ` Kay Sievers
2010-08-06 8:05 ` Daniel Lezcano [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=4C5BC232.1030304@free.fr \
--to=daniel.lezcano@free.fr \
--cc=cfriesen@nortel.com \
--cc=kay.sievers@vrfy.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.