linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Martin Oliveira <martin.oliveira@eideticom.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-rdma@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Artemy Kovalyov <artemyko@nvidia.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	Logan Gunthorpe <logang@deltatee.com>,
	Michael Guralnik <michaelgur@nvidia.com>,
	Mike Marciniszyn <mike.marciniszyn@intel.com>,
	Tejun Heo <tj@kernel.org>, John Hubbard <jhubbard@nvidia.com>,
	Dan Williams <dan.j.williams@intel.com>,
	David Sloan <david.sloan@eideticom.com>
Subject: Re: [PATCH v3 1/3] kernfs: remove page_mkwrite() from vm_operations_struct
Date: Fri, 5 Jul 2024 00:20:35 -0700	[thread overview]
Message-ID: <Zoeew3RMOoUIMHz9@infradead.org> (raw)
In-Reply-To: <310071c8-04b7-4996-a496-614c2bdb8163@eideticom.com>

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..



  reply	other threads:[~2024-07-05  7:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 16:37 [PATCH v3 0/3] Enable P2PDMA in Userspace RDMA Martin Oliveira
2024-07-04 16:37 ` [PATCH v3 1/3] kernfs: remove page_mkwrite() from vm_operations_struct Martin Oliveira
2024-07-04 16:48   ` Greg Kroah-Hartman
2024-07-04 17:02   ` Matthew Wilcox
2024-07-04 20:43     ` Martin Oliveira
2024-07-05  7:20       ` Christoph Hellwig [this message]
2024-07-08 16:31         ` Martin Oliveira
2024-07-04 16:37 ` [PATCH v3 2/3] mm/gup: allow FOLL_LONGTERM & FOLL_PCI_P2PDMA Martin Oliveira
2024-07-04 16:37 ` [PATCH v3 3/3] RDMA/umem: add support for P2P RDMA Martin Oliveira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zoeew3RMOoUIMHz9@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=artemyko@nvidia.com \
    --cc=dan.j.williams@intel.com \
    --cc=david.sloan@eideticom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=martin.oliveira@eideticom.com \
    --cc=michaelgur@nvidia.com \
    --cc=mike.marciniszyn@intel.com \
    --cc=tj@kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox