[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 0/4] 9p: get rid of readdir_r()
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH 0/4] 9p: get rid of readdir_r() |
Date: |
Thu, 02 Jun 2016 10:51:58 +0200 |
User-agent: |
StGit/0.17.1-dirty |
The readdir_r() function has a broken design and should not be used anymore.
It is expected to be obsoleted in a future version of POSIX.1:
http://austingroupbugs.net/view.php?id=696#c2857
Glibc has already announced that 2.24 (scheduled for August 2016) will
deprecates readdir_r() and encourages people to use readdir() with
external synchronization instead.
This series replaces readdir_r() by readdir() and changes the internal API
in fsdev/file-op-9p.h to be readdir-like, like it was before commit
"5f524c1ebcc5 use readdir_r instead of readdir for reentrancy".
The 9p code runs in coroutines, called either:
- from the QEMU main-loop when ioventfd=on, which is the default, or
- from vCPU context when ioeventfd=off, with the qemu_global_mutex
taken
All hypothetical critical sections around the use of readdir() are then
already serialized. This series introduces a serialization anyway for the
code to be fully independant from the context.
Since POSIX.1 will require readdir() to be thread-safe when employed on
different directory streams, and glibc already does that, the choice
was made to have per-directory locking.
Unsurprisingly, there is no contention and the locking/unlocking hasn't
any noticeable impact on performance.
Since early glibc-2.24 users are already encountering build breaks, I guess
this should go upstream sooner than later. I plan to issue a pull request
next week, or even before if possible.
Please comment !
Thanks.
---
Greg Kurz (4):
9p: drop useless out: label
9p: introduce the V9fsDir type
9p: add locking to V9fsDir
9p: switch back to readdir()
fsdev/file-op-9p.h | 3 +-
hw/9pfs/9p-handle.c | 24 +++++++++-----------
hw/9pfs/9p-local.c | 36 ++++++++++++++++--------------
hw/9pfs/9p-proxy.c | 26 ++++++++++-----------
hw/9pfs/9p-synth.c | 23 ++++++++-----------
hw/9pfs/9p-synth.h | 1 +
hw/9pfs/9p.c | 62 ++++++++++++++++++++++++++++++---------------------
hw/9pfs/9p.h | 22 +++++++++++++++++-
hw/9pfs/codir.c | 12 ++++++----
hw/9pfs/coth.h | 3 +-
10 files changed, 120 insertions(+), 92 deletions(-)
--
Greg
- [Qemu-devel] [PATCH 0/4] 9p: get rid of readdir_r(),
Greg Kurz <=
- [Qemu-devel] [PATCH 1/4] 9p: drop useless out: label, Greg Kurz, 2016/06/02
- [Qemu-devel] [PATCH 2/4] 9p: introduce the V9fsDir type, Greg Kurz, 2016/06/02
- [Qemu-devel] [PATCH 3/4] 9p: add locking to V9fsDir, Greg Kurz, 2016/06/02
- [Qemu-devel] [PATCH 4/4] 9p: switch back to readdir(), Greg Kurz, 2016/06/02
- Re: [Qemu-devel] [PATCH 0/4] 9p: get rid of readdir_r(), Peter Maydell, 2016/06/02