public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Andrew Morton <akpm@digeo.com>
Cc: alan@lxorguk.ukuu.org.uk, marcelo@conectiva.com.br,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.4.21-pre7 ide request races
Date: Mon, 14 Apr 2003 12:58:33 +0200	[thread overview]
Message-ID: <20030414105833.GY9776@suse.de> (raw)
In-Reply-To: <20030414102723.GS9776@suse.de>

On Mon, Apr 14 2003, Jens Axboe wrote:
> On Mon, Apr 14 2003, Andrew Morton wrote:
> > Jens Axboe <axboe@suse.de> wrote:
> > >
> > > How would that solve the problem? The request could be gone even before
> > > end_that_request_last() is run, that is the issue.
> > 
> > In that case I didn't understand your description of the bug even the tiniest
> > little bit.
> > 
> > That request is sitting in the kernel stack of some process which is sleeping
> > in wait_for_completion().  Hence it is safe memory until someone runs
> > complete() against the completion struct.
> 
> Sorry you are right, that should fix the problem as well! Your fix is
> probably the better one for 2.4, less intrusive. I'll kill the stack
> requests in 2.5 then.

Marcelo,

Please apply this simpler variant. Thanks!

--- /opt/kernel/linux-2.4.21-pre7/drivers/block/ll_rw_blk.c	2003-04-14 10:48:21.000000000 +0200
+++ drivers/block/ll_rw_blk.c	2003-04-14 12:53:03.000000000 +0200
@@ -1375,11 +1403,12 @@
 
 void end_that_request_last(struct request *req)
 {
-	if (req->waiting != NULL)
-		complete(req->waiting);
-	req_finished_io(req);
+	struct completion *waiting = req->waiting;
 
+	req_finished_io(req);
 	blkdev_release_request(req);
+	if (waiting)
+		complete(waiting);
 }
 
 int __init blk_dev_init(void)

-- 
Jens Axboe


  reply	other threads:[~2003-04-14 10:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-14  9:34 [PATCH] 2.4.21-pre7 ide request races Jens Axboe
2003-04-14 10:07 ` Andrew Morton
2003-04-14 10:17   ` Jens Axboe
2003-04-14 10:23     ` Andrew Morton
2003-04-14 10:27       ` Jens Axboe
2003-04-14 10:58         ` Jens Axboe [this message]
2003-04-14 16:15         ` Mike Anderson
2003-04-14 19:02           ` Jens Axboe

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=20030414105833.GY9776@suse.de \
    --to=axboe@suse.de \
    --cc=akpm@digeo.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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