Re: [PATCH] pipe: don't update {a,c,m}time for anonymous pipes

From: Linus Torvalds
Date: Tue Feb 04 2025 - 10:29:19 EST


On Tue, 4 Feb 2025 at 05:22, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> @@ -404,7 +409,7 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to)
> if (wake_next_reader)
> wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);
> kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
> - if (ret > 0)
> + if (ret > 0 && !is_pipe_inode(file_inode(filp)))
> file_accessed(filp);
> return ret;
> }

So I really don't kike that "is_pipe_inode()" thing.

Yes, it has superficial naming problems (it should be about
*anonymous* pipes, and that should be reflected in the name), but I
think the deeper problem is that I think this should just be a
different set of read/write functions entirely.

IOW, we should have "anon_pipe_read()" and "anon_pipe_write()", and
then the named pipes just do

int ret = anon_pipe_read(...);
if (ret > 0)
file_accessed(filp);
return ret;

instead. With no tests for "what kind of pipe is this" (same for the
write side, of course)

Linus