Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753905AbZIUU2i (ORCPT ); Mon, 21 Sep 2009 16:28:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752289AbZIUU2h (ORCPT ); Mon, 21 Sep 2009 16:28:37 -0400 Received: from mail2.shareable.org ([80.68.89.115]:57809 "EHLO mail2.shareable.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751990AbZIUU2g (ORCPT ); Mon, 21 Sep 2009 16:28:36 -0400 Date: Mon, 21 Sep 2009 21:28:23 +0100 From: Jamie Lokier To: Andreas Gruenbacher Cc: Eric Paris , Linus Torvalds , Evgeniy Polyakov , David Miller , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, alan@linux.intel.com, hch@infradead.org Subject: Re: fanotify as syscalls Message-ID: <20090921202823.GB14700@shareable.org> References: <20090912094110.GB24709@ioremap.net> <200909190000.43556.agruen@suse.de> <1253329471.2630.30.camel@dhcp231-106.rdu.redhat.com> <200909212204.51077.agruen@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200909212204.51077.agruen@suse.de> User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2848 Lines: 63 Andreas Gruenbacher wrote: > On Saturday, 19 September 2009 5:04:31 Eric Paris wrote: > > Let me start by saying I am agreeing I should pursue subtree > > notification. It's what I think everyone really wants. It's a great > > idea, and I think you might have a simple way to get close. Clearly > > these are avenues I'm willing and hoping to pursue. Also I say it > > again, I believe the interface as proposed (except maybe some of my > > exclusion stuff) is flexible enough to implement any of these ideas. > > Does anyone disagree? > > It does seem flexible enough. However, the current interface assumes "global" > listeners (the mask argument of fanotify_init): > > int fanotify_init(int flags, int f_flags, __u64 mask, > unsigned int priority); > > Once subtree support is added, this parameter becomes obsolete. That's pretty > broken for a syscall yet to be introduced. > > > BUT to solve one of the main problems fanotify is intending to solve it > > needs a way to be the 'fscking all notifier.' It needs to be the whole > > damn system. > > Think of a system after boot, with a single global namespace. Whatever you > access by filename is reachable from the namespace root. At this point, > nothing more global exists. A listener can watch the mount points of > interest, and everything's fine. > > What's a bit more tricky is to ensure that this listener will continue to > receive all events from whatever else is mounted anywhere, irrespective of > namespaces. I think we can get there. I think so to, and that'd be a great all round solution. We _have_ to receive mount & umount events to do this. But even inotify-style tracking needs those if it's to be accurate, so it's not an additional burden. It would be logical if fanotify could block and ack those in the same way as it can block and ack other accesses (with the usual filtering rules on which inodes trigger events, and which don't or are cached). As in to prevent: mount --bind innocent .bash_login, but also to ensure it always knows what's mounted when another event occurs. > By the way, Documentation/filesystems/sharedsubtree.txt describes how > filesystem namespaces work. Fortunately, after making a new namespace you can read the mounts in the new namespace from /proc/self/mount* (I think) without having to know anything about the shared subtree rules. So to follow monitoring/checking across all namespaces, it would (I think) be enough to receive a fanotify "new namespace" event, and Ack that event to allow the CLONE_NS to proceed. It's still tricky stuff though. -- Jamie -- 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/