Re: [PATCH 33/34] vfio/mdev: Use the driver core to create the 'remove' file

Kirti Wankhede
2022-04-12T21:04:21Z

On 4/11/2022 7:44 PM, Christoph Hellwig wrote:
> From: Jason Gunthorpe <jgg@nvidia.com>
>
> The device creator is supposed to use the dev.groups value to add sysfs
> files before device_add is called, not call sysfs_create_files() after
> device_add() returns. This creates a race with uevent delivery where the
> extra attribute will not be visible.
>
> This was being done because the groups had been co-opted by the mdev
> driver, now that prior patches have moved the driver's groups to the
> struct device_driver the dev.group is properly free for use here.
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/vfio/mdev/mdev_core.c | 1 +
> drivers/vfio/mdev/mdev_private.h | 2 ++
> drivers/vfio/mdev/mdev_sysfs.c | 19 ++++++++++---------
> 3 files changed, 13 insertions(+), 9 deletions(-)
>

Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>