diff options
author | Liu Yuan <tailai.ly@taobao.com> | 2012-12-17 14:17:26 +0800 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-01-02 16:08:58 +0100 |
commit | bd751f2204a03d6fcd47a4b4b12ac534d2ecbea7 (patch) | |
tree | d06a3a3e97f20444af4fe75df5dab640de060e64 | |
parent | fccedc624c425e3acb1557f9f9b13104427ec5ce (diff) | |
download | qemu-bd751f2204a03d6fcd47a4b4b12ac534d2ecbea7.tar.gz qemu-bd751f2204a03d6fcd47a4b4b12ac534d2ecbea7.tar.bz2 qemu-bd751f2204a03d6fcd47a4b4b12ac534d2ecbea7.zip |
sheepdog: don't update inode when create_and_write fails
For the error case such as SD_RES_NO_SPACE, we shouldn't update the inode bitmap
to avoid the scenario that the object is allocated but wasn't created at the
server side. This will result in VM's IO error on the failed object.
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r-- | block/sheepdog.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c index 13dc023fdb..b9186fb92b 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -714,10 +714,11 @@ static void coroutine_fn aio_read_response(void *opaque) * and max_dirty_data_idx are changed to include updated * index between them. */ - s->inode.data_vdi_id[idx] = s->inode.vdi_id; - s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx); - s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx); - + if (rsp.result == SD_RES_SUCCESS) { + s->inode.data_vdi_id[idx] = s->inode.vdi_id; + s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx); + s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx); + } /* * Some requests may be blocked because simultaneous * create requests are not allowed, so we search the |