ide: Handle immediate bdrv_aio_flush failure
If bdrv_aio_flush returns NULL, this should be treated as an error. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
		
							parent
							
								
									a313358636
								
							
						
					
					
						commit
						b2df7531f3
					
				@ -811,10 +811,16 @@ static void ide_flush_cb(void *opaque, int ret)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static void ide_flush_cache(IDEState *s)
 | 
					static void ide_flush_cache(IDEState *s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (s->bs) {
 | 
					    BlockDriverAIOCB *acb;
 | 
				
			||||||
        bdrv_aio_flush(s->bs, ide_flush_cb, s);
 | 
					
 | 
				
			||||||
    } else {
 | 
					    if (s->bs == NULL) {
 | 
				
			||||||
        ide_flush_cb(s, 0);
 | 
					        ide_flush_cb(s, 0);
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    acb = bdrv_aio_flush(s->bs, ide_flush_cb, s);
 | 
				
			||||||
 | 
					    if (acb == NULL) {
 | 
				
			||||||
 | 
					        ide_flush_cb(s, -EIO);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user