linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Scholz <steven.scholz@imc-berlin.de>
To: Jens Axboe <axboe@suse.de>
Cc: linux-ide@vger.kernel.org, bzolnier@gmail.com
Subject: Re: Crash in ide_do_request() on card removal
Date: Tue, 02 Aug 2005 15:54:05 +0200	[thread overview]
Message-ID: <42EF7AFD.9090507@imc-berlin.de> (raw)
In-Reply-To: <20050802134546.GC2408@suse.de>

[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]

Jens Axboe wrote:

> On Tue, Aug 02 2005, Steven Scholz wrote:
> 
>>Jens Axboe wrote:
>>
>>
>>>On Tue, Aug 02 2005, Steven Scholz wrote:
>>>
>>>
>>>>Jens Axboe wrote:
>>>>
>>>>
>>>>
>>>>>It's not the right way, it only solves a little part of the problem.
>>>>>Killing a request with an error usually looks like this:
>>>>>
>>>>>	blkdev_dequeue_request(rq);
>>>>>	end_that_request_first(rq, 0, rq->hard_nr_sectors);
>>>>>	end_that_request_last(rq);
>>>>
>>>>How do I get the request? do_ide_request() only get the complete 
>>>>request_queue_t *q. Shell I use elv_next_request() ?
>>>
>>>Yes.
>>
>>So my workaround for now would be
>>
>>--- linux-2.6.13-rc5/drivers/ide/ide-io.c
>>+++ linux-2.6.13-rc4-at91-multiIO/drivers/ide/ide-io.c
>>@@ -1230,7 +1264,18 @@ void do_ide_request(request_queue_t *q)
>> {
>>        ide_drive_t *drive = q->queuedata;
>>
>>-       ide_do_request(HWGROUP(drive), IDE_NO_IRQ);
>>+       if (drive->present)
>>+               ide_do_request(HWGROUP(drive), IDE_NO_IRQ);
>>+       else {
>>+               struct request  *rq;
>>+               printk("%s() drive is not present anymore! Kill 
>>request.\n", __FUNCTION__);
>>+               rq = elv_next_request(q);
>>+               if (rq) {
>>+                       blkdev_dequeue_request(rq);
>>+                       end_that_request_first(rq, 0, rq->hard_nr_sectors);
>>+                       end_that_request_last(rq);
>>+               }
>>+       }
> 
> 
> Pretty close. Make the killing a loop:

...

[PATCH] ide: kill requests when drive is not present anymore

Signed-off-by: Steven Scholz <steven.scholz@imc-berlin.de>

Ok?

Change the CHANGELOG at your will.

--
Steven

[-- Attachment #2: ide_kill_rq.patch --]
[-- Type: text/plain, Size: 682 bytes --]

--- linux-2.6.13-rc5/drivers/ide/ide-io.c	2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.13-rc4-at91-multiIO/drivers/ide/ide-io.c	2005-08-02 15:46:53.000000000 +0200
@@ -1230,7 +1257,17 @@ void do_ide_request(request_queue_t *q)
 {
 	ide_drive_t *drive = q->queuedata;
 
-	ide_do_request(HWGROUP(drive), IDE_NO_IRQ);
+	if (drive->present)
+		ide_do_request(HWGROUP(drive), IDE_NO_IRQ);
+	else {
+		struct request	*rq;
+		printk(KERN_WARNING "%s: not present, killing requests\n", drive->name);
+		while ((rq = elv_next_request(q)) != NULL) {
+			blkdev_dequeue_request(rq);
+			end_that_request_first(rq, 0, rq->hard_nr_sectors);
+			end_that_request_last(rq);
+		}
+	}
 }
 
 /*

  reply	other threads:[~2005-08-02 13:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-29 12:01 Crash in ide_do_request() on card removal Steven Scholz
2005-08-02  9:57 ` Steven Scholz
2005-08-02 10:48   ` Jens Axboe
2005-08-02 11:10     ` Steven Scholz
2005-08-02 11:13       ` Jens Axboe
2005-08-02 11:17         ` Steven Scholz
2005-08-02 11:28           ` Jens Axboe
2005-08-02 11:30             ` Steven Scholz
2005-08-02 11:33               ` Jens Axboe
2005-08-02 12:09                 ` Steven Scholz
2005-08-02 12:26                   ` Jens Axboe
2005-08-02 12:40                     ` Steven Scholz
2005-08-02 12:54                       ` Jens Axboe
2005-08-02 13:03                         ` Steven Scholz
2005-08-02 13:06                           ` Jens Axboe
2005-08-02 13:38                             ` Steven Scholz
2005-08-02 13:45                               ` Jens Axboe
2005-08-02 13:54                                 ` Steven Scholz [this message]
2005-08-02 14:11                                   ` Jens Axboe
2005-08-08  9:00                                     ` Steven Scholz
2005-08-02 13:28                       ` Bartlomiej Zolnierkiewicz
2005-08-18 12:59                         ` Steven Scholz
2006-01-31 14:28                         ` Steven Scholz

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=42EF7AFD.9090507@imc-berlin.de \
    --to=steven.scholz@imc-berlin.de \
    --cc=axboe@suse.de \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).