[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whirZek1fZQ_gYGHZU71+UKDMa_MYWB5RzhP_owcjAopw@mail.gmail.com>
Date: Sun, 9 Feb 2025 10:17:47 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Oleg Nesterov <oleg@...hat.com>
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 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.
And honestly, if you worry so much about it, just allow the zero-sized
case. I don't see why you want to special-case it in the first place.
Yes, the zero sized buffer *used* to be a special case, but it was a
special case for writes.
And yes, splice wants to actually wait for "do we have real data" and
has that eat_empty_buffer() case, but just *keep* it.
Keeping that check is *better* and clearer than adding some pointless warning.
IOW, why warn for a case that isn't a problem, and you're only making
it a problem by thinking it is?
Linus
Powered by blists - more mailing lists