All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Matthew Wilcox <willy@infradead.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"VMware, Inc." <pv-drivers@vmware.com>,
	David Hildenbrand <david@redhat.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
	Minchan Kim <minchan@kernel.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	Nadav Amit <namit@vmware.com>, Al Viro <viro@zeniv.linux.org.uk>,
	Daniel Vetter <daniel@ffwll.ch>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linuxppc-dev@lists.ozlabs.org, Christoph Hellwig <hch@lst.de>,
	Nitin Gupta <ngupta@vflare.org>
Subject: Re: make alloc_anon_inode more useful
Date: Wed, 10 Mar 2021 09:37:23 +0100	[thread overview]
Message-ID: <20210310083723.GC5217@lst.de> (raw)
In-Reply-To: <20210310040545.GM3479805@casper.infradead.org>

On Wed, Mar 10, 2021 at 04:05:45AM +0000, Matthew Wilcox wrote:
> On Tue, Mar 09, 2021 at 04:53:39PM +0100, Christoph Hellwig wrote:
> > this series first renames the existing alloc_anon_inode to
> > alloc_anon_inode_sb to clearly mark it as requiring a superblock.
> > 
> > It then adds a new alloc_anon_inode that works on the anon_inode
> > file system super block, thus removing tons of boilerplate code.
> > 
> > The few remainig callers of alloc_anon_inode_sb all use alloc_file_pseudo
> > later, but might also be ripe for some cleanup.
> 
> On a somewhat related note, could I get you to look at
> drivers/video/fbdev/core/fb_defio.c?
> 
> As far as I can tell, there's no need for fb_deferred_io_aops to exist.
> We could just set file->f_mapping->a_ops to NULL, and set_page_dirty()
> would do the exact same thing this code does (except it would get the
> return value correct).

> But maybe that would make something else go wrong that distinguishes
> between page->mapping being NULL and page->mapping->a_ops->foo being NULL?

I can't find any place in the kernel that treats a NULL aops different
from not having the method it is looking for. 

> Completely untested patch ...

the patch looks mostly good to me.

>  	}
> -#ifdef CONFIG_FB_DEFERRED_IO
> -	if (info->fbdefio)
> -		fb_deferred_io_open(info, inode, file);
> -#endif
> +	file->f_mapping->a_ops = NULL;

But I'd also skip this.  Drivers generally do not set aops, but if they
do a funtion like this really should not override it.  This will require
an audit of the callers, though.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Matthew Wilcox <willy@infradead.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"VMware, Inc." <pv-drivers@vmware.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
	Minchan Kim <minchan@kernel.org>, Nadav Amit <namit@vmware.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Daniel Vetter <daniel@ffwll.ch>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linuxppc-dev@lists.ozlabs.org, Christoph Hellwig <hch@lst.de>,
	Nitin Gupta <ngupta@vflare.org>
Subject: Re: make alloc_anon_inode more useful
Date: Wed, 10 Mar 2021 09:37:23 +0100	[thread overview]
Message-ID: <20210310083723.GC5217@lst.de> (raw)
In-Reply-To: <20210310040545.GM3479805@casper.infradead.org>

On Wed, Mar 10, 2021 at 04:05:45AM +0000, Matthew Wilcox wrote:
> On Tue, Mar 09, 2021 at 04:53:39PM +0100, Christoph Hellwig wrote:
> > this series first renames the existing alloc_anon_inode to
> > alloc_anon_inode_sb to clearly mark it as requiring a superblock.
> > 
> > It then adds a new alloc_anon_inode that works on the anon_inode
> > file system super block, thus removing tons of boilerplate code.
> > 
> > The few remainig callers of alloc_anon_inode_sb all use alloc_file_pseudo
> > later, but might also be ripe for some cleanup.
> 
> On a somewhat related note, could I get you to look at
> drivers/video/fbdev/core/fb_defio.c?
> 
> As far as I can tell, there's no need for fb_deferred_io_aops to exist.
> We could just set file->f_mapping->a_ops to NULL, and set_page_dirty()
> would do the exact same thing this code does (except it would get the
> return value correct).

> But maybe that would make something else go wrong that distinguishes
> between page->mapping being NULL and page->mapping->a_ops->foo being NULL?

I can't find any place in the kernel that treats a NULL aops different
from not having the method it is looking for. 

> Completely untested patch ...

the patch looks mostly good to me.

>  	}
> -#ifdef CONFIG_FB_DEFERRED_IO
> -	if (info->fbdefio)
> -		fb_deferred_io_open(info, inode, file);
> -#endif
> +	file->f_mapping->a_ops = NULL;

But I'd also skip this.  Drivers generally do not set aops, but if they
do a funtion like this really should not override it.  This will require
an audit of the callers, though.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Matthew Wilcox <willy@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>, Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Daniel Vetter <daniel@ffwll.ch>, Nadav Amit <namit@vmware.com>,
	"VMware, Inc." <pv-drivers@vmware.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	virtualization@lists.linux-foundation.org,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: make alloc_anon_inode more useful
Date: Wed, 10 Mar 2021 09:37:23 +0100	[thread overview]
Message-ID: <20210310083723.GC5217@lst.de> (raw)
In-Reply-To: <20210310040545.GM3479805@casper.infradead.org>

On Wed, Mar 10, 2021 at 04:05:45AM +0000, Matthew Wilcox wrote:
> On Tue, Mar 09, 2021 at 04:53:39PM +0100, Christoph Hellwig wrote:
> > this series first renames the existing alloc_anon_inode to
> > alloc_anon_inode_sb to clearly mark it as requiring a superblock.
> > 
> > It then adds a new alloc_anon_inode that works on the anon_inode
> > file system super block, thus removing tons of boilerplate code.
> > 
> > The few remainig callers of alloc_anon_inode_sb all use alloc_file_pseudo
> > later, but might also be ripe for some cleanup.
> 
> On a somewhat related note, could I get you to look at
> drivers/video/fbdev/core/fb_defio.c?
> 
> As far as I can tell, there's no need for fb_deferred_io_aops to exist.
> We could just set file->f_mapping->a_ops to NULL, and set_page_dirty()
> would do the exact same thing this code does (except it would get the
> return value correct).

> But maybe that would make something else go wrong that distinguishes
> between page->mapping being NULL and page->mapping->a_ops->foo being NULL?

I can't find any place in the kernel that treats a NULL aops different
from not having the method it is looking for. 

> Completely untested patch ...

the patch looks mostly good to me.

>  	}
> -#ifdef CONFIG_FB_DEFERRED_IO
> -	if (info->fbdefio)
> -		fb_deferred_io_open(info, inode, file);
> -#endif
> +	file->f_mapping->a_ops = NULL;

But I'd also skip this.  Drivers generally do not set aops, but if they
do a funtion like this really should not override it.  This will require
an audit of the callers, though.

  reply	other threads:[~2021-03-10  8:37 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 15:53 make alloc_anon_inode more useful Christoph Hellwig
2021-03-09 15:53 ` Christoph Hellwig
2021-03-09 15:53 ` Christoph Hellwig
2021-03-09 15:53 ` [PATCH 1/9] fs: rename alloc_anon_inode to alloc_anon_inode_sb Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 16:21   ` David Hildenbrand
2021-03-09 16:21     ` David Hildenbrand
2021-03-09 16:21     ` David Hildenbrand
2021-03-09 16:21     ` David Hildenbrand
2021-03-09 19:33   ` Gao Xiang
2021-03-09 19:33     ` Gao Xiang
2021-03-09 19:33     ` Gao Xiang
2021-03-09 22:47   ` kernel test robot
2021-03-10  6:39   ` Minchan Kim
2021-03-10  6:39     ` Minchan Kim
2021-03-10  6:39     ` Minchan Kim
2021-03-10  6:39     ` Minchan Kim
2021-03-10  8:30     ` Christoph Hellwig
2021-03-10  8:30       ` Christoph Hellwig
2021-03-10  8:30       ` Christoph Hellwig
2021-03-10  9:33   ` Christian Brauner
2021-03-10  9:33     ` Christian Brauner
2021-03-10  9:33     ` Christian Brauner
2021-03-09 15:53 ` [PATCH 2/9] fs: add an argument-less alloc_anon_inode Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 16:22   ` David Hildenbrand
2021-03-09 16:22     ` David Hildenbrand
2021-03-09 16:22     ` David Hildenbrand
2021-03-09 16:22     ` David Hildenbrand
2021-03-09 19:34   ` Gao Xiang
2021-03-09 19:34     ` Gao Xiang
2021-03-09 19:34     ` Gao Xiang
2021-03-10  9:35   ` Christian Brauner
2021-03-10  9:35     ` Christian Brauner
2021-03-10  9:35     ` Christian Brauner
2021-03-09 15:53 ` [PATCH 3/9] powerpc/pseries: remove the ppc-cmm file system Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 16:26   ` David Hildenbrand
2021-03-09 16:26     ` David Hildenbrand
2021-03-09 16:26     ` David Hildenbrand
2021-03-09 16:26     ` David Hildenbrand
2021-03-09 16:30   ` Jason Gunthorpe
2021-03-09 16:30     ` Jason Gunthorpe
2021-03-09 16:30     ` Jason Gunthorpe
2021-03-10 16:29   ` Al Viro
2021-03-10 16:29     ` Al Viro
2021-03-10 16:29     ` Al Viro
2021-03-10 16:29     ` Al Viro
2021-03-11  8:42     ` Christoph Hellwig
2021-03-11  8:42       ` Christoph Hellwig
2021-03-11  8:42       ` Christoph Hellwig
2021-03-09 15:53 ` [PATCH 4/9] drm: remove the drm " Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-10 16:32   ` Al Viro
2021-03-10 16:32     ` Al Viro
2021-03-10 16:32     ` Al Viro
2021-03-10 16:32     ` Al Viro
2021-03-11  8:35     ` Christoph Hellwig
2021-03-11  8:35       ` Christoph Hellwig
2021-03-11  8:35       ` Christoph Hellwig
2021-03-09 15:53 ` [PATCH 5/9] vmw_balloon: remove the balloon-vmware " Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 16:28   ` David Hildenbrand
2021-03-09 16:28     ` David Hildenbrand
2021-03-09 16:28     ` David Hildenbrand
2021-03-09 16:28     ` David Hildenbrand
2021-03-09 15:53 ` [PATCH 6/9] virtio_balloon: remove the balloon-kvm " Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 16:29   ` David Hildenbrand
2021-03-09 16:29     ` David Hildenbrand
2021-03-09 16:29     ` David Hildenbrand
2021-03-09 16:29     ` David Hildenbrand
2021-03-09 15:53 ` [PATCH 7/9] iomem: remove the iomem " Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-14 13:55   ` [iomem] e14497b88f: BUG:KASAN:null-ptr-deref_in_alloc_anon_inode kernel test robot
2021-03-14 13:55     ` kernel test robot
2021-03-14 13:55     ` kernel test robot
2021-03-14 13:55     ` kernel test robot
2021-03-09 15:53 ` [PATCH 8/9] z3fold: remove the z3fold file system Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53 ` [PATCH 9/9] zsmalloc: remove the zsmalloc " Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-09 15:53   ` Christoph Hellwig
2021-03-10  6:44   ` Minchan Kim
2021-03-10  6:44     ` Minchan Kim
2021-03-10  6:44     ` Minchan Kim
2021-03-10  6:44     ` Minchan Kim
2021-03-09 16:54 ` make alloc_anon_inode more useful Jason Gunthorpe
2021-03-09 16:54   ` Jason Gunthorpe
2021-03-09 16:54   ` Jason Gunthorpe
2021-03-10  8:32   ` Christoph Hellwig
2021-03-10  8:32     ` Christoph Hellwig
2021-03-10  8:32     ` Christoph Hellwig
2021-03-10  4:05 ` Matthew Wilcox
2021-03-10  4:05   ` Matthew Wilcox
2021-03-10  4:05   ` Matthew Wilcox
2021-03-10  4:05   ` Matthew Wilcox
2021-03-10  8:37   ` Christoph Hellwig [this message]
2021-03-10  8:37     ` Christoph Hellwig
2021-03-10  8:37     ` Christoph Hellwig
2023-02-03  9:49 ` Jingbo Xu
2023-02-03  9:49   ` Jingbo Xu
2023-02-03  9:49   ` Jingbo Xu

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=20210310083723.GC5217@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=alex.williamson@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=david@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgg@nvidia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=minchan@kernel.org \
    --cc=mst@redhat.com \
    --cc=namit@vmware.com \
    --cc=ngupta@vflare.org \
    --cc=pv-drivers@vmware.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.