Looks like this fixed the problem. Thanks! Nate -----Original Message----- From: FUJITA Tomonori [mailto:fujita.tomonori@xxxxxxxxxxxxx] Sent: Monday, July 05, 2010 4:43 AM To: Dailey, Nate Cc: linux-scsi@xxxxxxxxxxxxxxx; James.Bottomley@xxxxxxx; dgilbert@xxxxxxxxxxxx Subject: Re: sg: remove disk while doing IO -> WARNING: at block/blk-core.c:1080 __blk_put_request On Wed, 30 Jun 2010 08:31:56 -0400 "Dailey, Nate" <Nate.Dailey@xxxxxxxxxxx> wrote: Thanks for the report. > I'm not sure what needs to be done to fix this (does sg_finish_rem_req > just need to null out req->bio, or is some cleanup actually missing?), > but I'm happy to test out a fix if anyone has any suggestions. Surely, we leak bio. I reproduced this. Can you try the following patch? = From: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> Subject: [PATCH] sg: fix bio leak with a detached device After blk_rq_map_user is successful, if we find that a device is unavailable (was detached), we must call blk_end_request_all to free bio(s) before blk_rq_unmap_user and blk_put_request. Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> --- drivers/scsi/sg.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index ef752b2..d454909 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -729,6 +729,8 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, return k; /* probably out of space --> ENOMEM */ } if (sdp->detached) { + if (srp->bio) + blk_end_request_all(srp->rq, -EIO); sg_finish_rem_req(srp); return -ENODEV; } -- 1.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html