LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Kirti Wankhede <kwankhede@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<cohuck@redhat.com>, <pasic@linux.ibm.com>
Subject: Re: [PATCH v4 2/2] vfio/mdev: Re-order sysfs attribute creation
Date: Sat, 19 May 2018 01:08:07 +0530	[thread overview]
Message-ID: <30699b42-a587-7235-5fec-e745cd5c925d@nvidia.com> (raw)
In-Reply-To: <20180518191035.3187.77957.stgit@gimli.home>



On 5/19/2018 12:40 AM, Alex Williamson wrote:
> There exists a gap at the end of mdev_device_create() where the device
> is visible to userspace, but we're not yet ready to handle removal, as
> triggered through the 'remove' attribute.  We handle this properly in
> mdev_device_remove() with an -EAGAIN return, but we can marginally
> reduce this gap by adding this attribute as a final step of our sysfs
> setup.
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

Looks good.

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

> ---
>  drivers/vfio/mdev/mdev_sysfs.c |   14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c
> index 802df210929b..249472f05509 100644
> --- a/drivers/vfio/mdev/mdev_sysfs.c
> +++ b/drivers/vfio/mdev/mdev_sysfs.c
> @@ -257,24 +257,24 @@ int  mdev_create_sysfs_files(struct device *dev, struct mdev_type *type)
>  {
>  	int ret;
>  
> -	ret = sysfs_create_files(&dev->kobj, mdev_device_attrs);
> -	if (ret)
> -		return ret;
> -
>  	ret = sysfs_create_link(type->devices_kobj, &dev->kobj, dev_name(dev));
>  	if (ret)
> -		goto device_link_failed;
> +		return ret;
>  
>  	ret = sysfs_create_link(&dev->kobj, &type->kobj, "mdev_type");
>  	if (ret)
>  		goto type_link_failed;
>  
> +	ret = sysfs_create_files(&dev->kobj, mdev_device_attrs);
> +	if (ret)
> +		goto create_files_failed;
> +
>  	return ret;
>  
> +create_files_failed:
> +	sysfs_remove_link(&dev->kobj, "mdev_type");
>  type_link_failed:
>  	sysfs_remove_link(type->devices_kobj, dev_name(dev));
> -device_link_failed:
> -	sysfs_remove_files(&dev->kobj, mdev_device_attrs);
>  	return ret;
>  }
>  
> 

  reply	other threads:[~2018-05-18 19:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 19:10 [PATCH v4 0/2] vfio/mdev: Device namespace protection Alex Williamson
2018-05-18 19:10 ` [PATCH v4 1/2] vfio/mdev: Check globally for duplicate devices Alex Williamson
2018-05-18 19:37   ` Kirti Wankhede
2018-05-22  8:13   ` Cornelia Huck
2018-05-22 15:53     ` Alex Williamson
2018-05-23  4:53       ` Zhenyu Wang
2018-05-18 19:10 ` [PATCH v4 2/2] vfio/mdev: Re-order sysfs attribute creation Alex Williamson
2018-05-18 19:38   ` Kirti Wankhede [this message]
2018-05-22  8:14   ` Cornelia Huck
2018-05-18 19:37 ` [PATCH v4 0/2] vfio/mdev: Device namespace protection Kirti Wankhede
2018-05-22 17:17 ` Halil Pasic
2018-05-22 18:38   ` Alex Williamson
2018-05-23  8:56     ` Cornelia Huck
2018-05-23 12:29       ` Halil Pasic
2018-05-23 13:34         ` Cornelia Huck

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=30699b42-a587-7235-5fec-e745cd5c925d@nvidia.com \
    --to=kwankhede@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pasic@linux.ibm.com \
    --subject='Re: [PATCH v4 2/2] vfio/mdev: Re-order sysfs attribute creation' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).