Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19274733rwd; Wed, 28 Jun 2023 07:19:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/jwLe40XW9/2uScK5Oub6QRV+enVOhGesRdKf6vk3BBAHDvVRfcK6NyyR8rzUajQxOHYh X-Received: by 2002:a2e:804f:0:b0:2b6:ad5b:732f with SMTP id p15-20020a2e804f000000b002b6ad5b732fmr4177542ljg.45.1687961963671; Wed, 28 Jun 2023 07:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687961963; cv=none; d=google.com; s=arc-20160816; b=fF1T8L890JgHB8A+f+lkKkgsELkgSGAhAYR24pN8IJrPcru8pEsFukBROoVpM0uz8Y SE3lmcqt+9F6Yp+SnDVsDFRXZJV1SCi58Km0EemUCMqBKYRKfFe4eSZktnw52qB1m6DH cJQ/9ySmlihkg23ZTg96dj9Oo9EYiSRWtFVok1gCl2aZxrQd+o2ABrfFkIDbNL4CrKiW vHmvkztMZjWDTsrcyRJCKxqCqLgff06Vd+SN+/CaV10Na5w3A9bC58EbiHN7F9hN4swM e+slTKfiNgOTOFe30Z/g552qNEfcmbdhHh4WzZ3C3tSLty1pABMi6gg1BK6b0LE9m4h4 lA0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yPaxtyuBCwLPaD8RSS8EaZb02FifsjqRTvpRb30GE3g=; fh=eEOs89AEFu19CcPAWAQ74I20ZPGhwTYjEwYZhX72jvw=; b=hkWD+MJ2RO5XbPzXQgGlfANhSPOXW2Ffdmt2nT8ZOeYm9vjZzspmF2OSRib+OYZnUm 7CL2SqHeMUiGhPqdTwFkmBOXPD8UxfbUOC1v5XYwlY6eohjViL3RWSw1DAUAV8Iah4Gl qEl8H5S4K8ou+RbTF5crmiI8uP+SCHCcupCMCgne64d4rJCeDso9awmpmtuCLxMw8tXF OCgpzRa0rA8XS78Yx1/r4ojbWbirztbS7nfLTlcTfrY2jjYq6g0jAJPoeRTz+xhoz1GG bOqgA8Fbp8a9L9XbGBXiLnSz9buVPT4aTM7sIThdkyAvV5bd+9bc0AeDRNdhesdCmaVi gKTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=MeeC6RLW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m19-20020a1709066d1300b00988a13c6a90si5482831ejr.601.2023.06.28.07.18.58; Wed, 28 Jun 2023 07:19:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=MeeC6RLW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231449AbjF1Nla (ORCPT + 99 others); Wed, 28 Jun 2023 09:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbjF1Nl2 (ORCPT ); Wed, 28 Jun 2023 09:41:28 -0400 Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74282129; Wed, 28 Jun 2023 06:41:27 -0700 (PDT) Received: by mail-vs1-xe36.google.com with SMTP id ada2fe7eead31-440db8e60c8so1800445137.0; Wed, 28 Jun 2023 06:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687959686; x=1690551686; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yPaxtyuBCwLPaD8RSS8EaZb02FifsjqRTvpRb30GE3g=; b=MeeC6RLWsSHHMKVgYkYX5Lq5xXO530qEXgoVCmjTnZDhhtqQqxfvpry/S6KRJCYMGA NpHRteUA6IubdjUoHto6TVrdJ2ZBm0Bl2+moTjlGHKkGZqQzZMzhO7H27SJ11yMtwpK0 Hp1506xYRo9SsYl3u7wTVSmvTzyjcNd6CeXgqC97J/eTsXk5qJ3P+BqT3YSn8FxSFVWe SPp4MR1Vq7uUoz6QjvNVr6jeOMU3j4rDB3ul/nZ6B72ACvdhJ6ecq/myYX4dtgqQ1O4s QIXHdHRR0a4LO8cLJe9MKPCRqSY5Fg1wLXzHLRxxF6Sht8Vy0yLUpgZQ547ZjLE8ynRx TQoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687959686; x=1690551686; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yPaxtyuBCwLPaD8RSS8EaZb02FifsjqRTvpRb30GE3g=; b=giKXdLRajMKvcABJyOCoYrEYwHIitFXb0exjnzwpqj7RwcUT8g3YrAUTsr11VZVit3 RSIqb7+TJkChE4t8gkaLG67b8nCHXXJOJ8pPbNBOLRiXiKnEn4AFl4qUfUdfeor0TtxR i9fI5FLJ1+h/synjKUmZ5oeDhuYspjsfWY6lTlDxba6C/hwew/fXwDAAiQEY9NfGCL84 H/rxGuY7oLsNIiJ1i2v+j5lr5HCyToh7kT7d3Dmza0SSuduv3mdhjzOd2zq9ARofgdou qKhwH2q782pQkPNLFvEpHw3jRPA1nJpcW6MfIKEv01K/1cQwPWNHVypG9/fMyqJAxA95 0rEw== X-Gm-Message-State: AC+VfDwCjYpgW8q8IgP8DLn4xWwJdWzGtivSm+XHX8tr04hgoRrIqccr D+HZEwNmAhlCwXqrT6Y3yl0wsLtDojzD/Z7vgYI= X-Received: by 2002:a67:f711:0:b0:443:9248:3410 with SMTP id m17-20020a67f711000000b0044392483410mr484425vso.32.1687959686332; Wed, 28 Jun 2023 06:41:26 -0700 (PDT) MIME-Version: 1.0 References: <20230628113853.2b67fic5nvlisx3r@quack3> In-Reply-To: <20230628113853.2b67fic5nvlisx3r@quack3> From: Amir Goldstein Date: Wed, 28 Jun 2023 16:41:14 +0300 Message-ID: Subject: Re: [PATCH v4 0/3] fanotify accounting for fs/splice.c To: Jan Kara Cc: =?UTF-8?Q?Ahelenia_Ziemia=C5=84ska?= , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Chung-Chiang Cheng , ltp@lists.linux.it Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 28, 2023 at 2:38=E2=80=AFPM Jan Kara wrote: > > Hello! > > On Tue 27-06-23 22:50:46, Ahelenia Ziemia=C5=84ska wrote: > > Always generate modify out, access in for splice; > > this gets automatically merged with no ugly special cases. > > > > No changes to 2/3 or 3/3. > > Thanks for the patches Ahelena! The code looks fine to me but to be hones= t > I still have one unresolved question so let me think about it loud here f= or > documentation purposes :). Do we want fsnotify (any filesystem > notification framework like inotify or fanotify) to actually generate > events on FIFOs? FIFOs are virtual objects and are not part of the > filesystem as such (well, the inode itself and the name is), hence > *filesystem* notification framework does not seem like a great fit to wat= ch > for changes or accesses there. And if we say "yes" for FIFOs, then why no= t > AF_UNIX sockets? Where do we draw the line? And is it all worth the > trouble? > > I understand the convenience of inotify working on FIFOs for the "tail -f= " > usecase but then wouldn't this better be fixed in tail(1) itself by using > epoll(7) for FIFOs which, as I've noted in my other reply, does not have > the problem that poll(2) has when there are no writers? > > Another issue with FIFOs is that they do not have a concept of file > position. For hierarchical storage usecase we are introducing events that > will report file ranges being modified / accessed and officially supporti= ng > FIFOs is one more special case to deal with. > > What is supporting your changes is that fsnotify mostly works for FIFOs > already now (normal reads & writes generate notification) so splice not > working could be viewed as an inconsistency. Sockets (although they are > visible in the filesystem) cannot be open so for them the illusion of bei= ng > a file is even weaker. > > So overall I guess I'm slightly in favor of making fsnotify generate even= ts > on FIFOs even with splice, provided Amir does not see a big trouble in > supporting this with his upcoming HSM changes. > I've also thought about this. The thing about the HSM events is that they are permission events and just like FAN_ACCESS_PERM, they originate from the common access control helpers {rw,remap}_verify_area(), which also happen to have the file range info (with ppos NULL for pipes). Ahelenia's patches do not add any new rw_verify_area() to pipes so no new FAN_ACCESS_PERM events were added. If we could go back to the design of fanotify we would have probably made it explicit that permission events are only allowed on regular files and dirs. For the new HSM events we can (and will) do that. In any case, the new events are supposed to be delivered with file access range records, so delivering HSM events on pipes wouldn't make any sense. So I do not see any problem with these patches wrt upcomping HSM events. However, note that these patches create more inconsistencies between IN_ACCESS and FAN_ACCESS_PERM on pipes. We can leave it at that if we want, but fixing the inconsistencies by adding more FAN_ACCESS_PERM events on pipes - this is not something that I wouldn't be comfortable with. If anything, we can remove FAN_ACCESS_PERM events from special files and see if anybody complains. I don't know of any users of FAN_ACCESS_PERM and even for FAN_OPEN_PERM, I don't think that AV-vendors have anything useful to do with open permission events on special files. Thanks, Amir.