Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19072981rwd; Wed, 28 Jun 2023 04:53:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlFOlJ8ZyiM55grKgoGC/ceqmyc0/PVpG+GkcrYIosP4qfq5x3bJbX4YVe7p95R27ShhXoQJ X-Received: by 2002:a05:6358:9db1:b0:134:e422:c500 with SMTP id d49-20020a0563589db100b00134e422c500mr164656rwo.27.1687953201213; Wed, 28 Jun 2023 04:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687953201; cv=none; d=google.com; s=arc-20160816; b=ICcsECS6SxrzDELQv4I2vQ9P6/J/oH+WJyi7+ftXJ7LqkH8g7vXNU5m51jyv3igIux 9FwYr2UvsbWsyqeq6L+HF7BT9pFQ3gRjb6UOVezdlT/K63bPTKqzevb95JX16fftz/QL RWMfwIK1AEOfyXee3ZFaA0mcvD0vd+efFUv/9b5wAnvDMEX+cObE4oH2p4ZOQfkWCHa1 viGUGqUx163mSCfOEVOzvBHmwtXY1H4Gkd48SmEiozHKkNvQSrS8okKYFJetQIGYZD5S /+cHBKiyywHJvqmEif1etW4rID1TpDStOu0l+2LQq/EmY1CC64q1Jb3JS1nCOLo9XSC5 +0dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=gaYz0RfWL4tKkVaIfRwi0SkO2qSDidhpLiN6Nrrzd58=; fh=DFtkV2ekYF6uNtYJdZJjLspaJLsX1X3lrctQrrBjTgo=; b=k5xnqmxUzTe1+b89sF/oyhRmS/UDCUhZ6Dkb/wKS1ZxI7ghZL3uIOZP8c9Qk5tGH3T tNbVaE9Hi0ZsxgS2Zci1HoH2qBhrErudBJeVl9eub4vTEWEF4b3BVDhB3njQdPTM9EK+ +LuwkPMThHYt9DHV3o46BXCU+pE5hl6JHeqMeazBXWlsdYIJWR8N8Yxvz+tPyIYuz75i NiCSpShGw9+2SVLtP7G5EC5lWfZSkeR54Z1VgZ7r4WysLLjQlB/XSxS4Hi4kFLI+XI3u b0kG0Vno/9MQcTYsghRx6cPVpv/UmTZsgoR3FwdSz9AbIN4EKmwYnbDRkqytC2KwFR/l N13w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=qJkTySOu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="B23rf3/d"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t62-20020a638141000000b00543d33304e6si9109738pgd.667.2023.06.28.04.53.07; Wed, 28 Jun 2023 04:53:21 -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=@suse.cz header.s=susede2_rsa header.b=qJkTySOu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="B23rf3/d"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230449AbjF1LjE (ORCPT + 99 others); Wed, 28 Jun 2023 07:39:04 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:59740 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231563AbjF1Liz (ORCPT ); Wed, 28 Jun 2023 07:38:55 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4546B1F889; Wed, 28 Jun 2023 11:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1687952334; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gaYz0RfWL4tKkVaIfRwi0SkO2qSDidhpLiN6Nrrzd58=; b=qJkTySOukwfsUrrcrYV6XJCZIEVqYJTySEk4/dmbSBnharGbGrsKM6RKxYP2Y+Spk5Nxf5 Raew5mwvfoIlqdaSQqz2xk8wJtJafu5x3er6s5r9jlKnM5JNP1slPelZAh+y1uuvZmgD/M AgN2KbULxCY73jMLwYepsEWES0I1WQs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1687952334; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gaYz0RfWL4tKkVaIfRwi0SkO2qSDidhpLiN6Nrrzd58=; b=B23rf3/dGr8ohdTbWwcEONbM4T+RlbCFDv9efd2JhsLg7t5TXHt8XlSIYJBoyDNEAYGZIu 3spB9gGbDICBesCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3494B138E8; Wed, 28 Jun 2023 11:38:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yovODM4bnGSSQQAAMHmgww (envelope-from ); Wed, 28 Jun 2023 11:38:54 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id BDA7AA0707; Wed, 28 Jun 2023 13:38:53 +0200 (CEST) Date: Wed, 28 Jun 2023 13:38:53 +0200 From: Jan Kara To: Ahelenia =?utf-8?Q?Ziemia=C5=84ska?= Cc: Amir Goldstein , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Chung-Chiang Cheng , ltp@lists.linux.it Subject: Re: [PATCH v4 0/3] fanotify accounting for fs/splice.c Message-ID: <20230628113853.2b67fic5nvlisx3r@quack3> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! On Tue 27-06-23 22:50:46, Ahelenia Ziemiańska 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 honest I still have one unresolved question so let me think about it loud here for 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 watch for changes or accesses there. And if we say "yes" for FIFOs, then why not 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 supporting 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 being a file is even weaker. So overall I guess I'm slightly in favor of making fsnotify generate events on FIFOs even with splice, provided Amir does not see a big trouble in supporting this with his upcoming HSM changes. Honza > Ahelenia Ziemiańska (3): > splice: always fsnotify_access(in), fsnotify_modify(out) on success > splice: fsnotify_access(fd)/fsnotify_modify(fd) in vmsplice > splice: fsnotify_access(in), fsnotify_modify(out) on success in tee > > fs/splice.c | 38 ++++++++++++++++++++------------------ > 1 file changed, 20 insertions(+), 18 deletions(-) > > Interdiff against v3: > diff --git a/fs/splice.c b/fs/splice.c > index 2ecfccbda956..bdbabc2ebfff 100644 > --- a/fs/splice.c > +++ b/fs/splice.c > @@ -1184,10 +1184,6 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out, > out->f_pos = offset; > else > *off_out = offset; > - > - // splice_write-> already marked out > - // as modified via vfs_iter_write() > - goto noaccessout; > } else if (opipe) { > if (off_out) > return -ESPIPE; > @@ -1211,11 +1207,10 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out, > } else > return -EINVAL; > > - if (ret > 0) > + if (ret > 0) { > fsnotify_modify(out); > -noaccessout: > - if (ret > 0) > fsnotify_access(in); > + } > > return ret; > } > -- > 2.39.2 -- Jan Kara SUSE Labs, CR