From: Jens Axboe <axboe@suse.de>

For the flush generated requests, we don't have room for sense info right
now.  This might change in the future so that the sd end_io function can
make a better judgement on what to do about an error.  So check this in
scsi_io_completion(), only copy sense data to request if it has space
assigned to it.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/scsi/scsi_lib.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/scsi_lib.c~scsi_io_completion-sense-copy drivers/scsi/scsi_lib.c
--- 25/drivers/scsi/scsi_lib.c~scsi_io_completion-sense-copy	2005-02-02 22:54:36.603483512 -0800
+++ 25-akpm/drivers/scsi/scsi_lib.c	2005-02-02 22:54:57.607290448 -0800
@@ -726,7 +726,7 @@ void scsi_io_completion(struct scsi_cmnd
 		req->errors = result;
 		if (result) {
 			clear_errors = 0;
-			if (sense_valid) {
+			if (sense_valid && req->sense) {
 				/*
 				 * SG_IO wants current and deferred errors
 				 */
_