Home
last modified time | relevance | path

Searched hist:"7 cde47d4" (Results 1 – 2 of 2) sorted by relevance

/openbmc/qemu/hw/9pfs/
H A D9p.h7cde47d4 Mon Jun 06 04:52:34 CDT 2016 Greg Kurz <gkurz@linux.vnet.ibm.com> 9p: add locking to V9fsDir

If several threads concurrently call readdir() with the same directory
stream pointer, it is possible that they all get a pointer to the same
dirent structure, whose content is overwritten each time readdir() is
called.

We must thus serialize accesses to the dirent structure.

This may be achieved with a mutex like below:

lock_mutex();

readdir();

// work with the dirent

unlock_mutex();

This patch adds all the locking, to prepare the switch to readdir().

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
H A D9p.c7cde47d4 Mon Jun 06 04:52:34 CDT 2016 Greg Kurz <gkurz@linux.vnet.ibm.com> 9p: add locking to V9fsDir

If several threads concurrently call readdir() with the same directory
stream pointer, it is possible that they all get a pointer to the same
dirent structure, whose content is overwritten each time readdir() is
called.

We must thus serialize accesses to the dirent structure.

This may be achieved with a mutex like below:

lock_mutex();

readdir();

// work with the dirent

unlock_mutex();

This patch adds all the locking, to prepare the switch to readdir().

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>