• G
    9p: add locking to V9fsDir · 7cde47d4
    Greg Kurz 提交于
    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: NEric Blake <eblake@redhat.com>
    Signed-off-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
    7cde47d4
9p.h 7.0 KB