qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 37179e: sockets: update SOCKET_ADDRESS_TYPE_F


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 37179e: sockets: update SOCKET_ADDRESS_TYPE_FD listen(2) b...
Date: Fri, 21 May 2021 02:00:40 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 37179e9ea45d6428b29ae789209c119ac18c1d39
      
https://github.com/qemu/qemu/commit/37179e9ea45d6428b29ae789209c119ac18c1d39
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2021-05-11 (Tue, 11 May 2021)

  Changed paths:
    M util/qemu-sockets.c

  Log Message:
  -----------
  sockets: update SOCKET_ADDRESS_TYPE_FD listen(2) backlog

socket_get_fd() fails with the error "socket_get_fd: too many
connections" if the given listen backlog value is not 1.

Not all callers set the backlog to 1. For example, commit
582d4210eb2f2ab5baac328fe4b479cd86da1647 ("qemu-nbd: Use SOMAXCONN for
socket listen() backlog") uses SOMAXCONN. This will always fail with in
socket_get_fd().

This patch calls listen(2) on the fd to update the backlog value. The
socket may already be in the listen state. I have tested that this works
on Linux 5.10 and macOS Catalina.

As a bonus this allows us to detect when the fd cannot listen. Now we'll
be able to catch unbound or connected fds in socket_listen().

Drop the num argument from socket_get_fd() since this function is also
called by socket_connect() where a listen backlog value does not make
sense.

Fixes: e5b6353cf25c99c3f08bf51e29933352f7140e8f ("socket: Add backlog parameter 
to socket_listen")
Reported-by: Richard W.M. Jones <rjones@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210310173004.420190-1-stefanha@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>


  Commit: da9076f323d1470c65634893aa2427987699d4f1
      
https://github.com/qemu/qemu/commit/da9076f323d1470c65634893aa2427987699d4f1
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M util/qemu-sockets.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2021-05-11' into 
staging

nbd patches for 2021-05-11

- fix fd passing to qemu-storage-daemon --nbd-server

# gpg: Signature made Tue 11 May 2021 20:26:22 BST
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) 
<ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2021-05-11:
  sockets: update SOCKET_ADDRESS_TYPE_FD listen(2) backlog

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/0b5acf89c1b1...da9076f323d1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]