public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* mount notification question
@ 2010-08-02 21:12 Daniel Lezcano
  2010-08-04 18:41 ` Chris Friesen
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lezcano @ 2010-08-02 21:12 UTC (permalink / raw)
  To: Linux Kernel Mailing List


Hi all,

is there a way to be notified when a mount occurs on the system ?

Thanks
   -- Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mount notification question
  2010-08-02 21:12 mount notification question Daniel Lezcano
@ 2010-08-04 18:41 ` Chris Friesen
  2010-08-06  1:07   ` Daniel Lezcano
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Friesen @ 2010-08-04 18:41 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: Linux Kernel Mailing List

On 08/02/2010 03:12 PM, Daniel Lezcano wrote:
> 
> Hi all,
> 
> 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

Chris

-- 
The author works for GENBAND Corporation (GENBAND) who is solely
responsible for this email and its contents. All enquiries regarding
this email should be addressed to GENBAND. Nortel has provided the use
of the nortel.com domain to GENBAND in connection with this email solely
for the purpose of connectivity and Nortel Networks Inc. has no
liability for the email or its contents. GENBAND's web site is
http://www.genband.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mount notification question
  2010-08-04 18:41 ` Chris Friesen
@ 2010-08-06  1:07   ` Daniel Lezcano
  2010-08-06  7:44     ` Kay Sievers
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lezcano @ 2010-08-06  1:07 UTC (permalink / raw)
  To: Chris Friesen; +Cc: Linux Kernel Mailing List

On 08/04/2010 08:41 PM, Chris Friesen wrote:
> On 08/02/2010 03:12 PM, Daniel Lezcano wrote:
>    
>> Hi all,
>>
>> 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 ?

Thanks
   -- Daniel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mount notification question
  2010-08-06  1:07   ` Daniel Lezcano
@ 2010-08-06  7:44     ` Kay Sievers
  2010-08-06  8:05       ` Daniel Lezcano
  0 siblings, 1 reply; 5+ messages in thread
From: Kay Sievers @ 2010-08-06  7:44 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: Chris Friesen, Linux Kernel Mailing List

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.

Kay

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mount notification question
  2010-08-06  7:44     ` Kay Sievers
@ 2010-08-06  8:05       ` Daniel Lezcano
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Lezcano @ 2010-08-06  8:05 UTC (permalink / raw)
  To: Kay Sievers; +Cc: Chris Friesen, Linux Kernel Mailing List

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-06  8:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox