Skip to content

Commit

Permalink
scsi: core: scsi_io_completion convert BUGs to WARNs
Browse files Browse the repository at this point in the history
The scsi_io_completion function contains three BUG() and BUG_ON() calls.
Replace them with WARN variants.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Douglas Gilbert authored and Martin K. Petersen committed Jun 26, 2018
1 parent 0d43790 commit 8e1695a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,13 +1060,21 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
scsi_req(req->next_rq)->resid_len = scsi_in(cmd)->resid;
if (scsi_end_request(req, BLK_STS_OK, blk_rq_bytes(req),
blk_rq_bytes(req->next_rq)))
BUG();
WARN_ONCE(true,
"Bidi command with remaining bytes");
return;
}
}

/* no bidi support yet, other than in pass-through */
BUG_ON(blk_bidi_rq(req));
if (unlikely(blk_bidi_rq(req))) {
WARN_ONCE(true, "Only support bidi command in passthrough");
scmd_printk(KERN_ERR, cmd, "Killing bidi command\n");
if (scsi_end_request(req, BLK_STS_IOERR, blk_rq_bytes(req),
blk_rq_bytes(req->next_rq)))
WARN_ONCE(true, "Bidi command with remaining bytes");
return;
}

/*
* Next deal with any sectors which we were able to correctly
Expand All @@ -1089,7 +1097,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
/* Kill remainder if no retries. */
if (unlikely(blk_stat && scsi_noretry_cmd(cmd))) {
if (scsi_end_request(req, blk_stat, blk_rq_bytes(req), 0))
BUG();
WARN_ONCE(true,
"Bytes remaining after failed, no-retry command");
return;
}

Expand Down

0 comments on commit 8e1695a

Please sign in to comment.