diff options
Diffstat (limited to 'drivers/block/xen-blkback/blkback.c')
-rw-r--r-- | drivers/block/xen-blkback/blkback.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index a1ee2659d2bc..79efec24569b 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -456,15 +456,15 @@ static void xen_blk_drain_io(struct xen_blkif *blkif) | |||
456 | { | 456 | { |
457 | atomic_set(&blkif->drain, 1); | 457 | atomic_set(&blkif->drain, 1); |
458 | do { | 458 | do { |
459 | /* The initial value is one, and one refcnt taken at the | ||
460 | * start of the xen_blkif_schedule thread. */ | ||
461 | if (atomic_read(&blkif->refcnt) <= 2) | ||
462 | break; | ||
459 | wait_for_completion_interruptible_timeout( | 463 | wait_for_completion_interruptible_timeout( |
460 | &blkif->drain_complete, HZ); | 464 | &blkif->drain_complete, HZ); |
461 | 465 | ||
462 | if (!atomic_read(&blkif->drain)) | 466 | if (!atomic_read(&blkif->drain)) |
463 | break; | 467 | break; |
464 | /* The initial value is one, and one refcnt taken at the | ||
465 | * start of the xen_blkif_schedule thread. */ | ||
466 | if (atomic_read(&blkif->refcnt) <= 2) | ||
467 | break; | ||
468 | } while (!kthread_should_stop()); | 468 | } while (!kthread_should_stop()); |
469 | atomic_set(&blkif->drain, 0); | 469 | atomic_set(&blkif->drain, 0); |
470 | } | 470 | } |
@@ -502,11 +502,11 @@ static void __end_block_io_op(struct pending_req *pending_req, int error) | |||
502 | make_response(pending_req->blkif, pending_req->id, | 502 | make_response(pending_req->blkif, pending_req->id, |
503 | pending_req->operation, pending_req->status); | 503 | pending_req->operation, pending_req->status); |
504 | xen_blkif_put(pending_req->blkif); | 504 | xen_blkif_put(pending_req->blkif); |
505 | free_req(pending_req); | ||
506 | if (atomic_read(&pending_req->blkif->refcnt) <= 2) { | 505 | if (atomic_read(&pending_req->blkif->refcnt) <= 2) { |
507 | if (atomic_read(&pending_req->blkif->drain)) | 506 | if (atomic_read(&pending_req->blkif->drain)) |
508 | complete(&pending_req->blkif->drain_complete); | 507 | complete(&pending_req->blkif->drain_complete); |
509 | } | 508 | } |
509 | free_req(pending_req); | ||
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||