[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250209184427.GA27435@redhat.com>
Date: Sun, 9 Feb 2025 19:44:28 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Christian Brauner <brauner@...nel.org>,
Jeff Layton <jlayton@...nel.org>,
David Howells <dhowells@...hat.com>,
"Gautham R. Shenoy" <gautham.shenoy@....com>,
K Prateek Nayak <kprateek.nayak@....com>,
Mateusz Guzik <mjguzik@...il.com>,
Neeraj Upadhyay <Neeraj.Upadhyay@....com>,
Oliver Sang <oliver.sang@...el.com>,
Swapnil Sapkal <swapnil.sapkal@....com>,
WangYuli <wangyuli@...ontech.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] pipe: change pipe_write() to never add a zero-sized
buffer
On 02/09, Linus Torvalds wrote:
>
> On Sun, 9 Feb 2025 at 10:02, Oleg Nesterov <oleg@...hat.com> wrote:
> >
> > Could you explain what do you think should I do if I keep this check?
> > make pipe_buf_assert_len() return void? or just replace it with
> > WARN_ON_ONCE(!buf->len) in its callers?
>
> Just replace it with WARN_ON_ONCE() in any place where you really
> think it's needed.
OK, will do.
> IOW, why warn for a case that isn't a problem, and you're only making
> it a problem by thinking it is?
Again, lets look eat_empty_buffer().
The comment says "maybe it's empty" but how/why can this happen ?
The changelog for d1a819a2ec2d3 ("splice: teach splice pipe reading
about empty pipe buffers") says "you can trigger it by doing a write
to a pipe that fails" but if someone looks at anon_pipe_write() after
1/2 this case is not possible.
And if eat_empty_buffer() flushes the buffer and updates pipe->tail,
why doesn't it wake the writers?
WARN_ON_ONCE() makes it clear that we do not expect !buf->len == 0,
and the kernel will complain if it does happen.
So unless you have a strong opinion, I'd prefer to keep it for now.
Oleg.
Powered by blists - more mailing lists