mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marko Rauhamaa <marko@pacujo.net>
To: linux-kernel@vger.kernel.org
Subject: fanotify and namespaces/bind mounts
Date: Thu, 29 Oct 2015 15:29:53 +0200	[thread overview]
Message-ID: <87y4elol9q.fsf@elektro.pacujo.net> (raw)


If I call fanotify_mark(... FAN_MARK_ADD | FAN_MARK_MOUNT ...), I get
notifications on all files on the file system.

Except I don't.

If a process has mounted directories on the file system in a different
namespace, the global namespace experiences file system events but no
fanotify events are generated. A similar limitation applies to bind
mounts.

You can easily see this behavior in action. Do "man fanotify", and copy
the example program to, say, example.c. Then,

    cc -o example example.c
    mkdir -p /mnt/xyz
    mount -o bind /root /mnt/xyz
    ./example /root

The last command prints out fanotify events. It will display events for

    touch /root/xyzzy

but nothing for

    touch /mnt/xyz/zyxxy

or

    unshare -m touch /root/yxyyx

Should the current situation be considered a bug in fanotify? Or is
there another recommended way to monitor file system events
categorigally?


Marko

             reply	other threads:[~2015-10-29 13:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29 13:29 Marko Rauhamaa [this message]
2017-03-18 14:04 ` riya khanna

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=87y4elol9q.fsf@elektro.pacujo.net \
    --to=marko@pacujo.net \
    --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®