From: Dominik Brodowski <linux@brodo.de>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
B.Zolnierkiewicz@elka.pw.edu.pl
Subject: ide: indeed, using list_for_each_entry_safe removes endless looping / hang [Was: Re: 2.5.65-ac2 -- hda/ide trouble on ICH4]
Date: Sun, 23 Mar 2003 19:25:54 +0100 [thread overview]
Message-ID: <20030323182554.GA1270@brodo.de> (raw)
In-Reply-To: <20030323181532.GA6819@brodo.de>
On Sun, Mar 23, 2003 at 07:15:33PM +0100, Dominik Brodowski wrote:
> On Sun, Mar 23, 2003 at 06:41:10PM +0000, Alan Cox wrote:
> > > printk("%4s\n", drive->name) prints out "hdd" all the time.
> > >
> > > hda is an ATA disk drive
> > > hdb is empty
> > > hdc is an ATAPI CD/DVD-ROM drive
> > > hdd is an ATAPI CD-ROM CD-R/RW drive
> >
> > This gets weirder by the minute, and I still can't get it to happen here
> > annoyingly.
> >
> > The list thats breaking is a private list. We delete the drive from that
> > list, if its present (it may be an empty bay) we then use ata_attach
> > to add it to a device list (or back to ata_unused).
> >
> > I find it hard to believe something like this is a compiler bug, but right
> > now I don't see how stuff is reappearing on the list.
>
> Just got it to boot :) -- the while(!list_empty...) { list_entry ... looks
> suspicious. Might be better to use list_for_each_safe() which is designed
> exactly for this purpouse. I'm currently recompiling
> 2.5.65-bk-current-as-of-yesterday with the attached patch. Let's see whether
> it works with this kernel, too...
Yes, it also works with 2.5.65-bkX.
--- linux/drivers/ide/ide.c.original 2003-03-23 19:08:40.000000000 +0100
+++ linux/drivers/ide/ide.c 2003-03-23 19:10:25.000000000 +0100
@@ -2392,6 +2392,8 @@
int ide_register_driver(ide_driver_t *driver)
{
struct list_head list;
+ struct list_head *list_loop;
+ struct list_head *tmp_storage;
spin_lock(&drivers_lock);
list_add(&driver->drivers, &drivers);
@@ -2402,8 +2404,8 @@
list_splice_init(&ata_unused, &list);
spin_unlock(&drives_lock);
- while (!list_empty(&list)) {
- ide_drive_t *drive = list_entry(list.next, ide_drive_t, list);
+ list_for_each_safe(list_loop, tmp_storage, &list) {
+ ide_drive_t *drive = container_of(list_loop, ide_drive_t, list);
list_del_init(&drive->list);
if (drive->present)
ata_attach(drive);
next prev parent reply other threads:[~2003-03-23 18:15 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-22 14:03 2.5.65-ac2 -- hda/ide trouble on ICH4 Dominik Brodowski
2003-03-22 16:35 ` Alan Cox
2003-03-22 16:25 ` Dominik Brodowski
2003-03-22 17:42 ` Alan Cox
2003-03-22 16:39 ` Jan Dittmer
2003-03-23 1:03 ` Dominik Brodowski
2003-03-23 15:47 ` Alan Cox
2003-03-23 14:59 ` Dominik Brodowski
2003-03-23 18:41 ` Alan Cox
2003-03-23 18:15 ` Dominik Brodowski
2003-03-23 18:25 ` Dominik Brodowski [this message]
2003-03-23 22:16 ` ide: indeed, using list_for_each_entry_safe removes endless looping / hang [Was: Re: 2.5.65-ac2 -- hda/ide trouble on ICH4] Jan Dittmer
2003-03-24 11:08 ` PROBLEM: linux-2.5.65-ac3 does not boot whith IDE-drivers Norbert Wolff
2003-03-24 13:54 ` Alan Cox
2003-03-24 9:55 ` ide: indeed, using list_for_each_entry_safe removes endless looping / hang [Was: Re: 2.5.65-ac2 -- hda/ide trouble on ICH4] Alexander Atanasov
2003-03-24 13:59 ` Alan Cox
2003-03-24 16:01 ` Alexander Atanasov
2003-03-24 17:40 ` Alan Cox
2003-03-24 17:24 ` Alexander Atanasov
2003-03-25 4:16 ` Andre Hedrick
2003-03-25 13:59 ` Alan Cox
2003-03-25 20:05 ` Bartlomiej Zolnierkiewicz
2003-03-25 20:24 ` Bartlomiej Zolnierkiewicz
2003-04-03 7:00 ` PATCH:ide_do_reset() fix for 2.5.66 rain.wang
2003-04-03 7:16 ` Jens Axboe
2003-04-03 8:36 ` PATCH RFC :ide_do_reset() " rain.wang
2003-04-10 3:37 ` [rfc][patch]: fix handler race in HDIO_DRIVE_RESET path for 2.5.67-ac1 rain.wang
2003-03-22 22:03 ` [PATCH] Re: 2.5.65-ac2 -- hda/ide trouble on ICH4 Bartlomiej Zolnierkiewicz
2003-03-22 23:27 ` Alan Cox
2003-03-22 22:33 ` Bartlomiej Zolnierkiewicz
2003-03-23 9:11 ` Dominik Brodowski
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=20030323182554.GA1270@brodo.de \
--to=linux@brodo.de \
--cc=B.Zolnierkiewicz@elka.pw.edu.pl \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@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