blockdev: use drained_begin/end for qmp_block_resize
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1447551 If one tries to issue a block_resize while a guest is busy accessing the disk, it is possible that qemu may deadlock when invoking aio_poll from both the main loop and the iothread. Replace another instance of bdrv_drain_all that doesn't quite belong. Cc: qemu-stable@nongnu.org Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
		
							parent
							
								
									c03e7ef12a
								
							
						
					
					
						commit
						698bdfa07d
					
				@ -2923,10 +2923,9 @@ void qmp_block_resize(bool has_device, const char *device,
 | 
				
			|||||||
        goto out;
 | 
					        goto out;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* complete all in-flight operations before resizing the device */
 | 
					    bdrv_drained_begin(bs);
 | 
				
			||||||
    bdrv_drain_all();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ret = blk_truncate(blk, size, errp);
 | 
					    ret = blk_truncate(blk, size, errp);
 | 
				
			||||||
 | 
					    bdrv_drained_end(bs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
    blk_unref(blk);
 | 
					    blk_unref(blk);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user