[Top][All Lists]

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

[Qemu-commits] [qemu/qemu] 6a55c8: sheepdog: serialize requests to overw

From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 6a55c8: sheepdog: serialize requests to overwrapping area
Date: Tue, 28 Jul 2015 06:30:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 6a55c82cece217ab99ed95a412fa7ddf5d5f257b
  Author: Hitoshi Mitake <address@hidden>
  Date:   2015-07-28 (Tue, 28 Jul 2015)

  Changed paths:
    M block/sheepdog.c

  Log Message:
  sheepdog: serialize requests to overwrapping area

Current sheepdog driver only serializes create requests in oid
unit. This mechanism isn't enough for handling requests to
overwrapping area spanning multiple oids, so it can result bugs like

This patch adds a new serialization mechanism for the problem. The
difference from the old one is:
1. serialize entire aiocb if their targetting areas overwrap
2. serialize all requests (read, write, and discard), not only creates

This patch also removes the old mechanism because the new one can be
an alternative.

Cc: Kevin Wolf <address@hidden>
Cc: Stefan Hajnoczi <address@hidden>
Cc: Teruaki Ishizaki <address@hidden>
Cc: Vasiliy Tolstov <address@hidden>
Signed-off-by: Hitoshi Mitake <address@hidden>
Tested-by: Vasiliy Tolstov <address@hidden>
Signed-off-by: Jeff Cody <address@hidden>

  Commit: 325e3904210c779a13fbbc9ee156056d045d7eee
  Author: Richard W.M. Jones <address@hidden>
  Date:   2015-07-28 (Tue, 28 Jul 2015)

  Changed paths:
    M block/ssh.c

  Log Message:
  block/ssh: Avoid segfault if inet_connect doesn't set errno.

On some (but not all) systems:

  $ qemu-img create -f qcow2 overlay -b ssh://xen/
  Segmentation fault

It turns out this happens when inet_connect returns -1 in the
following code, but errno == 0.

  s->sock = inet_connect(s->hostport, errp);
  if (s->sock < 0) {
      ret = -errno;
      goto err;

In the test case above, no host called "xen" exists, so getaddrinfo fails.

On Fedora 22, getaddrinfo happens to set errno = ENOENT (although it
is *not* documented to do that), so it doesn't segfault.

On RHEL 7, errno is not set by the failing getaddrinfo, so ret =
-errno = 0, so the caller doesn't know there was an error and
continues with a half-initialized BDRVSSHState struct, and everything
goes south from there, eventually resulting in a segfault.

Fix this by setting ret to -EIO (same as block/nbd.c and
block/sheepdog.c).  The real error is saved in the Error** errp
struct, so it is printed correctly:

  $ ./qemu-img create -f qcow2 overlay -b ssh://xen/
  qemu-img: overlay: address resolution failed for xen:22: No address 
associated with hostname

Signed-off-by: Richard W.M. Jones <address@hidden>
Reported-by: Jun Li
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1147343
Signed-off-by: Jeff Cody <address@hidden>

  Commit: 9f8c5b69c2b9ca8b9c3e569b0f41bd60a0b9e9fe
  Author: Peter Maydell <address@hidden>
  Date:   2015-07-28 (Tue, 28 Jul 2015)

  Changed paths:
    M block/sheepdog.c
    M block/ssh.c

  Log Message:
  Merge remote-tracking branch 
'remotes/cody/tags/jtc-for-upstream-pull-request' into staging

# gpg: Signature made Tue Jul 28 05:22:29 2015 BST using RSA key ID C0DE3057
# gpg: Good signature from "Jeffrey Cody <address@hidden>"
# gpg:                 aka "Jeffrey Cody <address@hidden>"
# gpg:                 aka "Jeffrey Cody <address@hidden>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* remotes/cody/tags/jtc-for-upstream-pull-request:
  block/ssh: Avoid segfault if inet_connect doesn't set errno.
  sheepdog: serialize requests to overwrapping area

Signed-off-by: Peter Maydell <address@hidden>

Compare: https://github.com/qemu/qemu/compare/776f87845137...9f8c5b69c2b9

reply via email to

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