On 06/02/2016 02:52 AM, Greg Kurz wrote: > If several threads call concurrently readdir() with the same directory
s/call concurrently/concurrently call/ > 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(). > > Signed-off-by: Greg Kurz <gk...@linux.vnet.ibm.com> > --- > hw/9pfs/9p.c | 21 +++++++++++++++++++++ > hw/9pfs/9p.h | 16 ++++++++++++++++ > 2 files changed, 37 insertions(+) > Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature