Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751571AbdCROMK (ORCPT ); Sat, 18 Mar 2017 10:12:10 -0400 Received: from mail-vk0-f48.google.com ([209.85.213.48]:36714 "EHLO mail-vk0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbdCROL7 (ORCPT ); Sat, 18 Mar 2017 10:11:59 -0400 MIME-Version: 1.0 In-Reply-To: <87y4elol9q.fsf@elektro.pacujo.net> References: <87y4elol9q.fsf@elektro.pacujo.net> From: riya khanna Date: Sat, 18 Mar 2017 10:04:00 -0400 Message-ID: Subject: Re: fanotify and namespaces/bind mounts To: Marko Rauhamaa Cc: linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1346 Lines: 45 Are fsnotify events generated per mount namespace? On Thu, Oct 29, 2015 at 9:29 AM, Marko Rauhamaa wrote: > > 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 > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/