kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, ddutile@redhat.com
Subject: Re: [PATCH] device-assignment: Better fd tracking
Date: Thu, 08 Jul 2010 11:32:07 +0300	[thread overview]
Message-ID: <4C358D07.1070405@redhat.com> (raw)
In-Reply-To: <20100707162948.5414.51749.stgit@localhost.localdomain>

On 07/07/2010 07:29 PM, Alex Williamson wrote:
> Commit 909bfdba fixed a hole with not closing resource file descriptors
> but we need to be more careful about tracking which are real fds,
> otherwise we might close fd 0, which doesn't work out so well for stdio.
>
> @@ -785,7 +786,8 @@ static void free_assigned_device(AssignedDevice *dev)
>                           fprintf(stderr,
>   				"Failed to unmap assigned device region: %s\n",
>   				strerror(errno));
> -                    close(pci_region->resource_fd);
> +                    if (pci_region->resource_fd>= 0)
> +                        close(pci_region->resource_fd);
>    

Missing  { }s.

>                   }
>   	    }
>           }
> @@ -793,10 +795,8 @@ static void free_assigned_device(AssignedDevice *dev)
>           if (dev->cap.available&  ASSIGNED_DEVICE_CAP_MSIX)
>               assigned_dev_unregister_msix_mmio(dev);
>
> -        if (dev->real_device.config_fd) {
> +        if (dev->real_device.config_fd>= 0)
>               close(dev->real_device.config_fd);
> -            dev->real_device.config_fd = 0;
> -        }
>    

Again.

>
>   #ifdef KVM_CAP_IRQ_ROUTING
>           free_dev_irq_entries(dev);
> @@ -1415,7 +1415,7 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
>
>       if (!dev->host.seg&&  !dev->host.bus&&  !dev->host.dev&&  !dev->host.func) {
>           error_report("pci-assign: error: no host device specified");
> -        goto out;
> +        return -1;
>       }
>    

-error is better than -1, but this is not introduces by this patch, so okay.

-- 
error compiling committee.c: too many arguments to function


  parent reply	other threads:[~2010-07-08  8:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 16:29 [PATCH] device-assignment: Better fd tracking Alex Williamson
2010-07-07 17:28 ` Don Dutile
2010-07-07 17:49   ` Alex Williamson
2010-07-08  8:32 ` Avi Kivity [this message]
2010-07-08 14:58 ` [PATCH v2] " Alex Williamson
2010-07-08 15:28   ` Don Dutile
2010-07-12 18:12   ` Marcelo Tosatti

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=4C358D07.1070405@redhat.com \
    --to=avi@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=ddutile@redhat.com \
    --cc=kvm@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).