block: fix cache flushing in bdrv_commit
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
		
							parent
							
								
									23fabed136
								
							
						
					
					
						commit
						1d44952fc7
					
				
							
								
								
									
										9
									
								
								block.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								block.c
									
									
									
									
									
								
							@ -557,6 +557,7 @@ int bdrv_commit(BlockDriverState *bs)
 | 
				
			|||||||
    BlockDriver *drv = bs->drv;
 | 
					    BlockDriver *drv = bs->drv;
 | 
				
			||||||
    int64_t i, total_sectors;
 | 
					    int64_t i, total_sectors;
 | 
				
			||||||
    int n, j;
 | 
					    int n, j;
 | 
				
			||||||
 | 
					    int ret = 0;
 | 
				
			||||||
    unsigned char sector[512];
 | 
					    unsigned char sector[512];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!drv)
 | 
					    if (!drv)
 | 
				
			||||||
@ -588,8 +589,10 @@ int bdrv_commit(BlockDriverState *bs)
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (drv->bdrv_make_empty)
 | 
					    if (drv->bdrv_make_empty) {
 | 
				
			||||||
	return drv->bdrv_make_empty(bs);
 | 
					        ret = drv->bdrv_make_empty(bs);
 | 
				
			||||||
 | 
					        bdrv_flush(bs);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * Make sure all data we wrote to the backing device is actually
 | 
					     * Make sure all data we wrote to the backing device is actually
 | 
				
			||||||
@ -597,7 +600,7 @@ int bdrv_commit(BlockDriverState *bs)
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    if (bs->backing_hd)
 | 
					    if (bs->backing_hd)
 | 
				
			||||||
        bdrv_flush(bs->backing_hd);
 | 
					        bdrv_flush(bs->backing_hd);
 | 
				
			||||||
    return 0;
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user