From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EB05C433B4 for ; Fri, 9 Apr 2021 10:09:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C5396115B for ; Fri, 9 Apr 2021 10:09:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233943AbhDIKKK (ORCPT ); Fri, 9 Apr 2021 06:10:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:56094 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234514AbhDIKIZ (ORCPT ); Fri, 9 Apr 2021 06:08:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8B833AF5B; Fri, 9 Apr 2021 10:08:11 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 47FB51F2B59; Fri, 9 Apr 2021 12:08:11 +0200 (CEST) Date: Fri, 9 Apr 2021 12:08:11 +0200 From: Jan Kara To: Amir Goldstein Cc: Jan Kara , Christian Brauner , linux-fsdevel , Miklos Szeredi , "J. Bruce Fields" Subject: Re: fsnotify path hooks Message-ID: <20210409100811.GA20833@quack2.suse.cz> References: <20210331094604.xxbjl3krhqtwcaup@wittgenstein> <20210331125412.GI30749@quack2.suse.cz> <20210401102947.GA29690@quack2.suse.cz> <20210408125258.GB3271@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu 08-04-21 18:11:31, Amir Goldstein wrote: > > > FYI, I tried your suggested approach above for fsnotify_xattr(), > > > but I think I prefer to use an explicit flavor fsnotify_xattr_mnt() > > > and a wrapper fsnotify_xattr(). > > > Pushed WIP to fsnotify_path_hooks branch. It also contains > > > some unstashed "fix" patches to tidy up the previous hooks. > > > > What's in fsnotify_path_hooks branch looks good to me wrt xattr hooks. > > I somewhat dislike about e.g. the fsnotify_create() approach you took is > > that there are separate hooks fsnotify_create() and fsnotify_create_path() > > which expose what is IMO an internal fsnotify detail of what are different > > event types. I'd say it is more natural (from VFS POV) to have just a > > single hook and fill in as much information as available... Also from > > So to be clear, you do NOT want additional wrappers like this and > you prefer to have the NULL mnt argument explicit in all callers? > > static inline void fsnotify_xattr(struct dentry *dentry) > { > fsnotify_xattr_mnt(NULL, dentry); > } > > For fsnotify_xattr() it does not matter so much, but fsnotify_create/mkdir() > have quite a few callers in special filesystems. Yes, I prefer explicit NULL mnt argument to make it obvious we are going to miss something in this case. I agree it's going to be somewhat bigger churn but it isn't that bad (10 + 6 callers). > > outside view, it is unclear that e.g. vfs_create() will generate some types > > of fsnotify events but not all while e.g. do_mknodat() will generate all > > fsnotify events. That's why I'm not sure whether a helper like vfs_create() > > in your tree is the right abstraction since generating one type of fsnotify > > event while not generating another type should be a very conscious decision > > of the implementor - basically if you have no other option. > > I lost you here. Sorry, I was probably too philosophical here ;) > Are you ok with vfs_create() vs. vfs_create_nonotify()? I'm OK with vfs_create_nonotify(). I have a problem with vfs_create() because it generates inode + fs events but does not generate mount events which is just strange (although I appreciate the technical reason behind it :). > How do you propose to change fsnotify hooks in vfs_create()? So either pass 'mnt' to vfs_create() - as we discussed, this may be actually acceptable these days due to idmapped mounts work - and generate all events there, or make vfs_create() not generate any fsnotify events and create new vfs_create_notify() which will take the 'mnt' and generate events. Either is fine with me and more consistent than what you currently propose. Thoughts? Honza -- Jan Kara SUSE Labs, CR