public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Brad Beveridge <bbeveridge@bluewatersys.com>
To: Brad Beveridge <bbeveridge@bluewatersys.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: BUG at dcache.h:276! Causing oops when I rmmod a nand module having mulitple partitions (fix)
Date: Thu, 25 Nov 2004 08:24:53 +1300	[thread overview]
Message-ID: <41A4E005.7040205@bluewatersys.com> (raw)
In-Reply-To: <41A15A30.4070808@bluewatersys.com>

Hi guys, we've managed to track down my mtd problem.

Setup:
- Using CONFIG_MTD_BLOCK
- Compiling your nand driver as a module
- Having multiple partitions defined

Problem:
insmodding the driver works, but when you rmmod the nand driver the 
kernel will oops.  The oops is caused by line 276 in dcache.h
The problem looks to be in mtd_blkdevs.c.  Everytime that 
add_mtd_blktrans_dev is called, a new gendisk is allocated, and its 
gd->queue member is set to
gd->queue = tr->blkcore_priv->rq;
The tr->blkcore_priv->rq appears to only get setup once in 
tr->blkcore_priv->rq.

Later, when del_mtd_blktrans_dev is called del_gendisk unregisters its 
queue.  So multiple gendisks point to the same queue & on removal they 
all try to get de-allocated.

Fix:
The very, very dodgy fix is to add
 ((struct gendisk *)old->blkcore_priv)->queue = NULL;
to del_mtd_blktrans_dev, just before del_gendisk is called.  This 
appears to let me rmmod my module without breakage.  Though I have no 
clue as to what the implications of doing this might be.

Can someone who knows the mtd_block layer better offer a proper fix?

Cheers
Brad

      reply	other threads:[~2004-11-24 19:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-22  1:41 BUG at dcache.h:276! Causing oops when I rmmod a nand module having mulitple partitions Brad Beveridge
2004-11-22  3:17 ` Brad Beveridge
2004-11-24 19:24   ` Brad Beveridge [this message]

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=41A4E005.7040205@bluewatersys.com \
    --to=bbeveridge@bluewatersys.com \
    --cc=linux-mtd@lists.infradead.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