Re: [PATCH] vfio: Reuse file f_inode as vfio device inode

From: Jason Gunthorpe
Date: Thu Jun 27 2024 - 08:42:26 EST


On Thu, Jun 27, 2024 at 05:51:01PM +0800, Yan Zhao wrote:

> > > > This doesn't seem right.. There is only one device but multiple file
> > > > can be opened on that device.
> Maybe we can put this assignment to vfio_df_ioctl_bind_iommufd() after
> vfio_df_open() makes sure device->open_count is 1.

Yeah, that seems better.

Logically it would be best if all places set the inode once the
inode/FD has been made to be the one and only way to access it.

> BTW, in group path, what's the benefit of allowing multiple open of device?

I don't know, the thing that opened the first FD can just dup it, no
idea why two different FDs would be useful. It is something we removed
in the cdev flow

Jason