[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zoeew3RMOoUIMHz9@infradead.org>
Date: Fri, 5 Jul 2024 00:20:35 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Martin Oliveira <martin.oliveira@...eticom.com>
Cc: Matthew Wilcox <willy@...radead.org>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-rdma@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Artemy Kovalyov <artemyko@...dia.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jason Gunthorpe <jgg@...pe.ca>, Leon Romanovsky <leon@...nel.org>,
Logan Gunthorpe <logang@...tatee.com>,
Michael Guralnik <michaelgur@...dia.com>,
Mike Marciniszyn <mike.marciniszyn@...el.com>,
Tejun Heo <tj@...nel.org>, John Hubbard <jhubbard@...dia.com>,
Dan Williams <dan.j.williams@...el.com>,
David Sloan <david.sloan@...eticom.com>
Subject: Re: [PATCH v3 1/3] kernfs: remove page_mkwrite() from
vm_operations_struct
On Thu, Jul 04, 2024 at 02:43:04PM -0600, Martin Oliveira wrote:
> On 2024-07-04 11:02, Matthew Wilcox wrote:> Seems to me we should actually _handle_ that, not do something wrong.
> > eg:
> >
> > if (vma->vm_ops) {
> > if (vma->vm_ops->close)
> > goto out_put;
> > if (WARN_ON(vma->vm_ops->page_mkwrite))
> > goto out_put;
> > }
>
> Good point.
Btw, sorry if I mislead you with my WARN_ON_ONCE suggestion. That
was always intended in addition to the error handling, not instead.
(In fact there are very few reasons to use WARN_ON* without actually
handling the error as well).
>
> > or maybe this doesn't need to be a WARN at all? After all, there
> > isn't one for having a ->close method, so why is page_mkwrite special?
>
> Hmm yeah, they should probably be treated the same.
>
> Maybe ->close should be converted to WARN as well? It would be easier to
> catch an error this way than chasing the EINVAL, but I'm OK either way.
Yes, doing the same for ->close or anything unimplemented would be
nice. But it's not really in scope for this series.
kernfs really should be using it's own ops instead of abusing
file_operations, but that's even more out of scope..
Powered by blists - more mailing lists