hw/9pfs: Use read-write lock for protecting fid path.

On rename we take the write lock and this ensure path
doesn't change as we operate on them.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
This commit is contained in:
Aneesh Kumar K.V 2011-05-24 15:10:56 +05:30
parent 70c18fc08b
commit 02cb7f3a25
8 changed files with 155 additions and 87 deletions

View file

@ -8,6 +8,8 @@
#include <sys/resource.h>
#include "hw/virtio.h"
#include "fsdev/file-op-9p.h"
#include "qemu-thread.h"
#include "qemu-coroutine.h"
/* The feature bitmap for virtio 9P */
/* The mount point is specified in a config variable */
@ -237,6 +239,11 @@ typedef struct V9fsState
size_t config_size;
enum p9_proto_version proto_version;
int32_t msize;
/*
* lock ensuring atomic path update
* on rename.
*/
CoRwlock rename_lock;
} V9fsState;
typedef struct V9fsStatState {