From: Boaz Harrosh <bharrosh@panasas.com>
To: James Bottomley <James.Bottomley@suse.de>,
linux-scsi <linux-scsi@vger.kernel.org>,
open-osd <osd-dev@open-osd.org>,
Benny Halevy <bhalevy@panasas.com>,
Alan Stern <stern@rowland.harvard.edu>
Cc: Stable Tree <stable@kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [osd-dev] [PATCH] scsi_lib: Bug in completion of bidi commands
Date: Thu, 31 Dec 2009 09:53:19 +0200 [thread overview]
Message-ID: <4B3C586F.8020200@panasas.com> (raw)
In-Reply-To: <4B27AA77.3040002@panasas.com>
On 12/15/2009 05:25 PM, Boaz Harrosh wrote:
>
> Because of the terrible structuring of scsi-bidi-commands
> it breaks some of the life time rules of a scsi-command.
> It is now not allowed to free up the block-request before
> cleanup and partial deallocation of the scsi-command. (Which
> is not so for none bidi commands)
>
> The right fix to this problem would be to make bidi command
> a first citizen by allocating a scsi_sdb pointer at scsi command
> just like cmd->prot_sdb. The bidi sdb should be allocated/deallocated
> as part of the get/put_command (Again like the prot_sdb) and the
> current decoupling of scsi_cmnd and blk-request should be kept.
>
> For now make sure scsi_release_buffers() is called before the
> call to blk_end_request_all() which might cause the suicide of
> the block requests. At best the leak of bidi buffers, at worse
> a crash, as there is a race between the existence of the bidi_request
> and the free of the associated bidi_sdb.
>
> The reason this was never hit before is because only OSD has the potential
> of doing asynchronous bidi commands. (So does bsg but it is never used)
> And OSD clients just happen to do all their bidi commands synchronously, up
> until recently.
>
> CC: Stable Tree <stable@kernel.org>
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
James hi.
What about this BUG. It affects anybody doing bidi commands. The possibilities
are an sglist leak at best, and a crash at worse.
I understand this code needs cleanup, but first things first. Lets first fix the
bug, which should also go to stable. Then the cleanup can go to next merge window.
BTW: Should I attempt a cleanup on current code, or should I wait for Alan's Patch
to go in first?
Thanks
Boaz
> ---
> drivers/scsi/scsi_lib.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 5987da8..bc9a881 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -749,9 +749,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
> */
> req->next_rq->resid_len = scsi_in(cmd)->resid;
>
> + scsi_release_buffers(cmd);
> blk_end_request_all(req, 0);
>
> - scsi_release_buffers(cmd);
> scsi_next_command(cmd);
> return;
> }
next parent reply other threads:[~2009-12-31 7:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4B27AA77.3040002@panasas.com>
2009-12-31 7:53 ` Boaz Harrosh [this message]
2010-01-01 2:46 ` [osd-dev] [PATCH] scsi_lib: Bug in completion of bidi commands Alan Stern
2010-01-03 10:11 ` Boaz Harrosh
2010-01-03 16:55 ` Alan Stern
2010-01-04 7:26 ` Boaz Harrosh
2010-01-12 11:16 ` Boaz Harrosh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B3C586F.8020200@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@suse.de \
--cc=bhalevy@panasas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=osd-dev@open-osd.org \
--cc=stable@kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox