Re: [PATCH v3 0/3+1] fanotify accounting for fs/splice.c

From: Jan Kara
Date: Wed Jun 28 2023 - 06:40:54 EST


On Tue 27-06-23 21:51:05, Christoph Hellwig wrote:
> Can you please resend this outside this thread? I really cant't see
> what's new or old here if you have a reply-to in the old thread.
>
> On Tue, Jun 27, 2023 at 06:55:22PM +0200, Ahelenia Ziemiańska wrote:
> > In 1/3 I've applied if/else if/else tree like you said,
> > and expounded a bit in the message.
> >
> > This is less pretty now, however, since it turns out that
> > iter_file_splice_write() already marks the out fd as written because it
> > writes to it via vfs_iter_write(), and that sent a double notification.
>
> It seems like vfs_iter_write is the wrong level to implement
> ->splice_write given that the the ->splice_write caller has already
> checked f_mode, done the equivalent of rw_verify_area and
> should do the fsnotify_modify. I'd suggest to just open code the
> relevant parts of vfs_iocb_iter_write in iter_file_splice_write.

Yeah, looking into the code I agree (with a small remark that unlike
vfs_iocb_iter_write() this particular variant also needs to work with files
providing only ->write and not ->write_iter). But we can live with
duplicate events for now and this seems like a rather separate cleanup to
do.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR