Skip to content
Commit 7cde47d4 authored by Greg Kurz's avatar Greg Kurz
Browse files

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: default avatarEric Blake <eblake@redhat.com>
Signed-off-by: default avatarGreg Kurz <gkurz@linux.vnet.ibm.com>
parent f314ea4e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment