Skip to content
Snippets Groups Projects
  • Fam Zheng's avatar
    3df9caf8
    scsi: Unify request unref in scsi_req_cancel · 3df9caf8
    Fam Zheng authored
    
    Before, scsi_req_cancel will take ownership of the canceled request and unref
    it. We did this because we didn't know whether AIO CB will be called or not
    during the cancelling, so we set the io_canceled flag before calling it, and
    skip unref in the potentially called callbacks, which is not very nice.
    
    Now, bdrv_aio_cancel has a stricter contract that the completion callbacks are
    always called, so we can remove the checks of req->io_canceled and just unref
    it in callbacks.
    
    It will also make implementing asynchronous cancellation easier.
    
    Signed-off-by: default avatarFam Zheng <famz@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    3df9caf8
    History
    scsi: Unify request unref in scsi_req_cancel
    Fam Zheng authored
    
    Before, scsi_req_cancel will take ownership of the canceled request and unref
    it. We did this because we didn't know whether AIO CB will be called or not
    during the cancelling, so we set the io_canceled flag before calling it, and
    skip unref in the potentially called callbacks, which is not very nice.
    
    Now, bdrv_aio_cancel has a stricter contract that the completion callbacks are
    always called, so we can remove the checks of req->io_canceled and just unref
    it in callbacks.
    
    It will also make implementing asynchronous cancellation easier.
    
    Signed-off-by: default avatarFam Zheng <famz@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>