From: Joachim Weller <Joachim_Weller@hsgmed.com>
To: Christoph Hellwig <hch@ns.caldera.de>
Cc: Joachim Weller <JoachimWeller@web.de>,
axboe@suse.de, linux-kernel@vger.kernel.org
Subject: Re: BUG: cat /proc/partitions endless loop
Date: Fri, 28 Sep 2001 17:22:46 +0200 [thread overview]
Message-ID: <3BB495C6.2B0A5ABB@hsgmed.com> (raw)
In-Reply-To: <200109281448.f8SEmvh08284@mailgate5.cinetic.de> <20010928170004.A14892@caldera.de>
Christoph Hellwig wrote:
>
> On Fri, Sep 28, 2001 at 04:48:57PM +0200, Joachim Weller wrote:
> > Christoph Hellwig <hch@ns.caldera.de> schrieb am 28.09.01:
> > > I think the fix could be simpler. What about:
> > [...]
> >
> > > + for (gp = gendisk_head; gp != gendisk_head; gp = gp->next) {
> >
> > This will break your for loop immedeately, because the loop criteria
> > is already violated by the initialization !
> >
> > But I tried another solution:
> > for (gp = gendisk_head; gp && (gp->next != gendisk_head); gp = gp->next) {
> >
> > with no success - the cat /proc/partition only printed the heading line.
> > This proofed to me, that the pointered list is created the wrong way,
> > in other words, gendisk_head->next is a pointer to itself.
> > It looks to me, that the "next" field in
> > /*static*/ struct gendisk *gendisk_head;
> > is not initialized (by the compiler ?) correctly to NULL.
>
> That's odd, could you try initilazing gendisk_head to NULL explicitly and try
> my proposed fix? The gendisk list handling starts to smell _really_ funny.
You would need to initialize gendisk_head->next to NULL *before* any call to
add_gendisk(struct gendisk *gp) takes place. The latter is used in many other
sources, to grow up the pointered list with additional partition info.
gendisk_head always points to the most recently added item.
When you step through the list, you reach the very first entry, which existed
before any call to add_gendisk() was made. And the "next" field of that should
point to NULL.
But instead of this, it points to itself, thus forming a ring pointered loop.
I don't know in which part of the kernel sources, that pre-initialization
of gendisk_head->next to NULL should be made. Maybe it is expected to be done
by the compiler.
But my fix works perfectly for me, resulting in exactly the same behaviour
as 2.4.9.
I should point out, that my 2.4.9 was compiled under gcc 2.95.2 (SuSE-6.4) , whereas
2.4.10 was compiled under 2.95.3 delivered by SuSE-7.2 ! Maybe that's the point.
--
Joachim Weller
Philips Medizinsysteme Boeblingen GmbH Mail: joachim_weller@hsgmed.com
Cardiac and Monitoring Systems (CMS) Phone: {+49|0}-7031-463-1891
New Product Engineering Fax: {+49|0}-7031-463-2112
Hewlett-Packard Str. 2, D 71034 Boeblingen -GERMANY-
next prev parent reply other threads:[~2001-09-28 15:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-28 14:48 Re: BUG: cat /proc/partitions endless loop Joachim Weller
2001-09-28 15:00 ` Christoph Hellwig
2001-09-28 15:22 ` Joachim Weller [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-09-28 13:15 Joachim Weller
2001-09-28 13:39 ` Christoph Hellwig
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=3BB495C6.2B0A5ABB@hsgmed.com \
--to=joachim_weller@hsgmed.com \
--cc=JoachimWeller@web.de \
--cc=axboe@suse.de \
--cc=hch@ns.caldera.de \
--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