diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2017-06-29 15:27:43 +0200 |
---|---|---|
committer | Fam Zheng <famz@redhat.com> | 2017-07-17 11:28:15 +0800 |
commit | 254aee4dbbec1b8ab0de23c435e927d1501bae34 (patch) | |
tree | 3e9b8a5acd815b9737d38f365a4c723d34d16204 | |
parent | 778b087e513ea6fdc525c5a194ff7c9b8d3f53cb (diff) |
vvfat: make it thread-safe
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20170629132749.997-6-pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
-rw-r--r-- | block/vvfat.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/block/vvfat.c b/block/vvfat.c index 4fd28e1e87..4dae790203 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -3078,8 +3078,14 @@ static int coroutine_fn write_target_commit(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { + int ret; + BDRVVVFATState* s = *((BDRVVVFATState**) bs->opaque); - return try_commit(s); + qemu_co_mutex_lock(&s->lock); + ret = try_commit(s); + qemu_co_mutex_unlock(&s->lock); + + return ret; } static void write_target_close(BlockDriverState *bs) { |