Patchwork [RFC,RDMA,support,v5:,12/12] don't set nonblock on invalid file descriptor

login
register
mail settings
Submitter mrhines@linux.vnet.ibm.com
Date April 9, 2013, 3:04 a.m.
Message ID <1365476681-31593-13-git-send-email-mrhines@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/234941/
State New
Headers show

Comments

mrhines@linux.vnet.ibm.com - April 9, 2013, 3:04 a.m.
From: "Michael R. Hines" <mrhines@us.ibm.com>

migration.c thinks this is an error for RDMA, but it's not.

Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
---
 util/oslib-posix.c |    2 ++
 1 file changed, 2 insertions(+)
Paolo Bonzini - April 9, 2013, 4:45 p.m.
Il 09/04/2013 05:04, mrhines@linux.vnet.ibm.com ha scritto:
> index 4e4b819..0b398f4 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -144,6 +144,8 @@ void qemu_set_block(int fd)
>  void qemu_set_nonblock(int fd)
>  {
>      int f;
> +    if(fd == -1)
> +        return;
>      f = fcntl(fd, F_GETFL);
>      fcntl(fd, F_SETFL, f | O_NONBLOCK);
>  }
> -- 1.7.10.4

Do you need to remove the assertion in process_incoming_migration, too?

I would prefer to touch process_incoming_migration instead, actually,
replacing the assertion with an if() there.

Paolo

Patch

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 4e4b819..0b398f4 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -144,6 +144,8 @@  void qemu_set_block(int fd)
 void qemu_set_nonblock(int fd)
 {
     int f;
+    if(fd == -1)
+        return;
     f = fcntl(fd, F_GETFL);
     fcntl(fd, F_SETFL, f | O_NONBLOCK);
 }