Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp123367pxh; Tue, 9 Nov 2021 22:31:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwaw/sF8ZsEOF4SeK6I//2PtHtSu8+2Vtu8kjst5OhgxbksZNIdY7fcf2yUKhw7Iw7mj2hZ X-Received: by 2002:a05:6402:354e:: with SMTP id f14mr17718820edd.166.1636525866504; Tue, 09 Nov 2021 22:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636525866; cv=none; d=google.com; s=arc-20160816; b=n+AqsTgcRhORrX2NHPUp+XxsMtGo0uwIo80QwLJoB1mtLPx1JYWLZdP83NGDz7BtmD QVG+rVISVK5UZm4U42gLMhjh0d2moRhQ7Rw1cKxKm594uS3guWCFyahzLnN/Dsn2BRHO E+GuK4W5hOsYA+txYW909A1l109LNqjR+RBzDV2ZKVWxsOtDIcpennmmO5J7UD0ho2UD 1hF4z9BUuqBCu/CpDSdmMXAWwRGMVUl/nYhLNxYMQ5Q0b0k+/3anJDwHwIhA0c946DNF c6A1DqcpLZPqJZi2bWYsi7AcXOcZFTRhHTduSaBCPDynWC/ECD+txlQb1Sk/InYr6rXg HtcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=omPGHcZQOamvxruFWJbitibaFxtFGC3+SEZUecILkcU=; b=Rmx21rSCX1SBLm7QtvUmxqTlhZCIY1lrMbR5TP8VtRUfLUqT1VWpEpkWmlNnPZHjhK gCYjb1xr576rUJt273T9KZYEjfnoMIYH6DvIOu+CueVP8edfWXZRsoh7B0DfZsqhRUcM 9MM1i9BJerZnnDiQyWwKQ4jd5tTgkOLZ8zy/Qc3kQ/2bw2uD0DxfIhOz9Fek4BXJ/TNl pH3GwUOVm7Y928S75zI2LbcphrXFiFhzgHzDGJ0SProFWIlz7dDS8BBOpil18WB5nNxL /vQEnyO9UTgqPENrkJBMCJuSm/nPq6xq1cReV+TUE0dBu6kc0MfPzHj827IzeReDutXf VqYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JRRgF2gW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c25si34034441edr.452.2021.11.09.22.30.42; Tue, 09 Nov 2021 22:31:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JRRgF2gW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbhKJGbO (ORCPT + 99 others); Wed, 10 Nov 2021 01:31:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbhKJGbM (ORCPT ); Wed, 10 Nov 2021 01:31:12 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6826C061766; Tue, 9 Nov 2021 22:28:25 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id w15so1394775ill.2; Tue, 09 Nov 2021 22:28:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=omPGHcZQOamvxruFWJbitibaFxtFGC3+SEZUecILkcU=; b=JRRgF2gWZl43etxwl1b8rEI6btrcMR3sK2fTidwaWvnPbgpHDPxyPSi30GoGNoacF/ swnNC5X7ZCBk6dDUJ+ZWfYHUbPZLD6twOoRqiBjVX0KnQot/BPVzBcfNmwVHfZVjkl8D NwjUe9gJ/2nZNPVRW1G2WfThaWcNKwkWltg/NCAGXR9Nc3Vb0BH3MhVakQCEBYylClyD Sl0ciRhdutKxTwc6tksCj3yKaf9lbFvyxQIKb5JKP2vcQVTfZblGbvWZ25XGNhR0oh+j nKa7LOKQdf6kcDxwDDRoA4C01yoymNtuzxj1Itd+qR2/S1EBlBZac8WHw4hjD7QMEppg eksQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=omPGHcZQOamvxruFWJbitibaFxtFGC3+SEZUecILkcU=; b=nTF3I41zrfdnPL+XcYUIr4KtTt+UQgbuiKuUXkw704Jh3/yNKbAWvWqwPes8sgFZLh OLt+xCqJYNTxk0sfo2YUwY799AtQ3OJ522Pb3iu80NG4exZNWQY1YUEMWn1d9ssjNsEv kbLVAGhF4P7UOJOjZvzqOUxc5vo/Pwxe4ZddUt7vi3iVaLbLJMv2gGfC8Xvd+KOvww2T hNS2yj2zN4kV4K923P5a7bh16uTXPH0fJGX97XSK81MLzsDaoh3u4FIeOkXOr+lsFOGr 9a9c7b6tbbh4ly4fFxHjQBg6HtPmPcjPfm0ohIx+L5SV8/Qw0RNw786HEpJTFBLPXswS fJ9g== X-Gm-Message-State: AOAM533wOE9R892hCs8X5A1Riv/T2wvoQ6JBjx5Qwau6acU7WIuXAjV0 5edjx8ipQhus8BwMS1GNImEQNjCYLsgtLNyKrY+DymO4JtA= X-Received: by 2002:a05:6e02:19ca:: with SMTP id r10mr10252891ill.319.1636525705204; Tue, 09 Nov 2021 22:28:25 -0800 (PST) MIME-Version: 1.0 References: <20211027132319.GA7873@quack2.suse.cz> <20211102110931.GD12774@quack2.suse.cz> <20211103100900.GB20482@quack2.suse.cz> <20211104100316.GA10060@quack2.suse.cz> In-Reply-To: From: Amir Goldstein Date: Wed, 10 Nov 2021 08:28:13 +0200 Message-ID: Subject: Re: [RFC PATCH 0/7] Inotify support in FUSE and virtiofs To: Vivek Goyal Cc: Jan Kara , Ioannis Angelakopoulos , linux-fsdevel , virtio-fs-list , linux-kernel , Al Viro , Miklos Szeredi , Steve French Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > OK, so do I understand both you and Amir correctly that you think that > > always relying on the FUSE server for generating the events and just piping > > them to the client is not long-term viable design for FUSE? Mostly because > > caching of modifications on the client is essentially inevitable and hence > > generating events from the server would be unreliable (delayed too much)? This is one aspect, but we do not have to tie remote notifications to the cache coherency problem that is more complicated. OTOH, if virtiofs take the route of "remote groups", why not take it one step further and implement "remote event queue". Then, it does not need to push event notifications from the server into fsnotify at all. Instead, FUSE client can communicate with the server using ioctl or a new command to implement new_group() that returns a special FUSE file and use FUSE POLL/READ to check/read the server's event queue. There is already a precedent of this model with CIFS_IOC_NOTIFY and SMB2_CHANGE_NOTIFY - SMB protocol, samba server and Windows server support watching a directory or a subtree. I think it is a "oneshot" watch, so there is no polling nor queue involved. > > So initial implementation could be about, application either get local > events or remote events (based on filesystem). Down the line more > complicated modes can emerge where some combination of local and remote > events could be generated and applications could specify it. That > probably will be extension of fanotiy/inotify API. > There is one more problem with this approach. We cannot silently change the behavior of existing FUSE filesystems. What if a system has antivirus configured to scan access to virtiofs mounts? Do you consider it reasonable that on system upgrade, the capability of adding local watches would go away? I understand the desire to have existing inotify applications work out of the box to get remote notifications, but I have doubts if this goal is even worth pursuing. Considering that the existing known use case described in this thread is already using polling to identify changes to config files on the host, it could just as well be using a new API to get the job done. If we had to plan an interface without considering existing applications, I think it would look something like: #define FAN_MARK_INODE 0x00000000 #define FAN_MARK_MOUNT 0x00000010 #define FAN_MARK_FILESYSTEM 0x00000100 #define FAN_MARK_REMOTE_INODE 0x00001000 #define FAN_MARK_REMOTE_FILESYSTEM 0x00001100 Then, the application can choose to add a remote mark with a certain event mask and a local mark with a different event mask without any ambiguity. The remote events could be tagged with a flag (turn reserved member of fanotify_event_metadata into flags). We have made a lot of effort to make fanotify a super set of inotify functionality removing old UAPI mistakes and baggage along the way, so I'd really hate to see us going down the path of ambiguous UAPI again. IMO, the work that Ioannis has already done to support remote notifications with virtiofsd is perfectly valid as a private functionality of virtiofs, just like cifs CIFS_IOC_NOTIFY. If we want to go further and implement a "remote notification subsystem" then I think we should take other fs (e.g.cifs) into consideration and think about functionality beyond the plain remote watch and create an UAPI that can be used to extend the functionality further. Thanks, Amir.