qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 03556e: 9pfs: include linux/limits.h for XATT


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 03556e: 9pfs: include linux/limits.h for XATTR_SIZE_MAX
Date: Tue, 26 May 2020 12:30:29 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 03556ea920b23c466ce7c1283199033de33ee671
      
https://github.com/qemu/qemu/commit/03556ea920b23c466ce7c1283199033de33ee671
  Author: Dan Robertson <address@hidden>
  Date:   2020-05-25 (Mon, 25 May 2020)

  Changed paths:
    M hw/9pfs/9p.c

  Log Message:
  -----------
  9pfs: include linux/limits.h for XATTR_SIZE_MAX

linux/limits.h should be included for the XATTR_SIZE_MAX definition used
by v9fs_xattrcreate.

Fixes: 3b79ef2cf488 ("9pfs: limit xattr size in xattrcreate")
Signed-off-by: Dan Robertson <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Christian Schoenebeck <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>


  Commit: ed463454efd0ac3042ff772bfe1b1d846dc281a5
      
https://github.com/qemu/qemu/commit/ed463454efd0ac3042ff772bfe1b1d846dc281a5
  Author: Greg Kurz <address@hidden>
  Date:   2020-05-25 (Mon, 25 May 2020)

  Changed paths:
    M hw/9pfs/9p.h

  Log Message:
  -----------
  9p: Lock directory streams with a CoMutex

Locking was introduced in QEMU 2.7 to address the deprecation of
readdir_r(3) in glibc 2.24. It turns out that the frontend code is
the worst place to handle a critical section with a pthread mutex:
the code runs in a coroutine on behalf of the QEMU mainloop and then
yields control, waiting for the fsdev backend to process the request
in a worker thread. If the client resends another readdir request for
the same fid before the previous one finally unlocked the mutex, we're
deadlocked.

This never bit us because the linux client serializes readdir requests
for the same fid, but it is quite easy to demonstrate with a custom
client.

A good solution could be to narrow the critical section in the worker
thread code and to return a copy of the dirent to the frontend, but
this causes quite some changes in both 9p.c and codir.c. So, instead
of that, in order for people to easily backport the fix to older QEMU
versions, let's simply use a CoMutex since all the users for this
sit in coroutines.

Fixes: 7cde47d4a89d ("9p: add locking to V9fsDir")
Reviewed-by: Christian Schoenebeck <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>


  Commit: cf45183b718f02b1369e18c795dc51bc1821245d
      
https://github.com/qemu/qemu/commit/cf45183b718f02b1369e18c795dc51bc1821245d
  Author: Stefano Stabellini <address@hidden>
  Date:   2020-05-25 (Mon, 25 May 2020)

  Changed paths:
    M hw/9pfs/9p.c
    M hw/9pfs/9p.h
    M hw/9pfs/virtio-9p-device.c
    M hw/9pfs/xen-9p-backend.c

  Log Message:
  -----------
  Revert "9p: init_in_iov_from_pdu can truncate the size"

This reverts commit 16724a173049ac29c7b5ade741da93a0f46edff7.
It causes https://bugs.launchpad.net/bugs/1877688.

Signed-off-by: Stefano Stabellini <address@hidden>
Reviewed-by: Christian Schoenebeck <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>


  Commit: a4c4d462729466c4756bac8a0a8d77eb63b21ef7
      
https://github.com/qemu/qemu/commit/a4c4d462729466c4756bac8a0a8d77eb63b21ef7
  Author: Stefano Stabellini <address@hidden>
  Date:   2020-05-25 (Mon, 25 May 2020)

  Changed paths:
    M hw/9pfs/xen-9p-backend.c

  Log Message:
  -----------
  xen/9pfs: yield when there isn't enough room on the ring

Instead of truncating replies, which is problematic, wait until the
client reads more data and frees bytes on the reply ring.

Do that by calling qemu_coroutine_yield(). The corresponding
qemu_coroutine_enter_if_inactive() is called from xen_9pfs_bh upon
receiving the next notification from the client.

We need to be careful to avoid races in case xen_9pfs_bh and the
coroutine are both active at the same time. In xen_9pfs_bh, wait until
either the critical section is over (ring->co == NULL) or until the
coroutine becomes inactive (qemu_coroutine_yield() was called) before
continuing. Then, simply wake up the coroutine if it is inactive.

Signed-off-by: Stefano Stabellini <address@hidden>
Reviewed-by: Christian Schoenebeck <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>


  Commit: 84af75577cceb195b044e2d5ba6d940206b169ca
      
https://github.com/qemu/qemu/commit/84af75577cceb195b044e2d5ba6d940206b169ca
  Author: Stefano Stabellini <address@hidden>
  Date:   2020-05-25 (Mon, 25 May 2020)

  Changed paths:
    M hw/9pfs/xen-9p-backend.c

  Log Message:
  -----------
  xen/9pfs: increase max ring order to 9

The max order allowed by the protocol is 9. Increase the max order
supported by QEMU to 9 to increase performance.

Signed-off-by: Stefano Stabellini <address@hidden>
Reviewed-by: Christian Schoenebeck <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>


  Commit: ddc760832fa8cf5e93b9d9e6e854a5114ac63510
      
https://github.com/qemu/qemu/commit/ddc760832fa8cf5e93b9d9e6e854a5114ac63510
  Author: Peter Maydell <address@hidden>
  Date:   2020-05-26 (Tue, 26 May 2020)

  Changed paths:
    M hw/9pfs/9p.c
    M hw/9pfs/9p.h
    M hw/9pfs/virtio-9p-device.c
    M hw/9pfs/xen-9p-backend.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/gkurz/tags/9p-next-2020-05-26' into 
staging

- fix build with musl libc
- fix potential deadlock of QEMU main event loop (cannot be hit with linux
  client)
- revert 9pfs reply truncation (LP 1877688)
- xen backend waits for client to free space on the reply ring instead of
  truncating or disconnecting

# gpg: Signature made Tue 26 May 2020 10:36:23 BST
# gpg:                using RSA key B4828BAF943140CEF2A3491071D4D5E5822F73D6
# gpg: Good signature from "Greg Kurz <address@hidden>" [full]
# gpg:                 aka "Gregory Kurz <address@hidden>" [full]
# gpg:                 aka "[jpeg image of size 3330]" [full]
# Primary key fingerprint: B482 8BAF 9431 40CE F2A3  4910 71D4 D5E5 822F 73D6

* remotes/gkurz/tags/9p-next-2020-05-26:
  xen/9pfs: increase max ring order to 9
  xen/9pfs: yield when there isn't enough room on the ring
  Revert "9p: init_in_iov_from_pdu can truncate the size"
  9p: Lock directory streams with a CoMutex
  9pfs: include linux/limits.h for XATTR_SIZE_MAX

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


Compare: https://github.com/qemu/qemu/compare/8f72c75cfc9b...ddc760832fa8



reply via email to

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