ub: remove BUG() after __blk_end_request and fix the condition causing it
authorPete Zaitcev <zaitcev@redhat.com>
Wed, 9 Apr 2008 00:41:51 +0000 (17:41 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Apr 2008 01:25:52 +0000 (18:25 -0700)
commitef45cb624b9517f71ad6c61299478c2cc08e4d98
treedc0b41ff7c7e58bb79b02437578a51d2848a0eb6
parent7180c4c9e09888db0a188f729c96c6d7bd61fa83
ub: remove BUG() after __blk_end_request and fix the condition causing it

When __blk_end_request returns nonzero, it means that the request was
not completely processed and some BIOs are still attached. Since we
have dequeued it by that time, it means leaking requests and hanging
processes, which is why BUG() was in there. In ub this happens if
a packet request ends normally, but with residue (e.g. when scsi_id
issues INQUIRY).

The fix is to make sure that arguments passed to __blk_end_request
are correct: the full request length and not just transferred length.
The transferred length is indicated to applications by adjusting
rq->data_len with old, unchanged code outside of this patch.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Cc: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Cc: Greg KH <greg@kroah.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/block/ub.c