mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jarkko Lavinen <jarkko.lavinen@nokia.com>
To: linux-kernel@vger.kernel.org
Cc: David Woodhouse <david.woodhouse@intel.com>,
	Maxim Levitsky <maximlevitsky@gmail.com>
Subject: MTD: mtd_blkdevs regression
Date: Fri, 10 Sep 2010 14:04:46 +0300	[thread overview]
Message-ID: <20100910110446.GA28045@angel.research.nokia.com> (raw)

In 2.6.34 modules using add_mtd_blktrans_dev() have reference
count 0 after loading and I can remove the module if it is not
being used. 

In 2.6.34, using mtdblock as an example:

    # modprobe nandsim
    # modprobe mtdblock
    # lsmod 
    Module                  Size  Used by
    mtdblock                2829  0 
    mtd_blkdevs             4217  1 mtdblock
    nandsim                25811  0 
    nand                   27184  1 nandsim
    nand_ids                2666  2 nandsim,nand
    nand_ecc                3392  1 nand
    mtd                    14794  5 mtd_blkdevs,nandsim,nand
    # rmmod mtdblock
    # 

Since commit 048d871 (mtd: blktrans: Hotplug fixes) in 2.6.35-rc1 
add_mtd_blktrans_dev() uses __get_module(tr->owner) to add reference 
count to calling module.

Because of this the module cannot be removed and since module
exit cannot be called, del_mtd_blktrans_dev() will not be called,
which would do the module_put().

In 2.6.35:

    # modprobe nandsim
    # modprobe mtdblock
    # lsmod
    Module                  Size  Used by
    mtdblock                2721  1 
    mtd_blkdevs             4895  1 mtdblock
    nandsim                25819  1 
    nand                   28326  1 nandsim
    nand_ids                2698  2 nandsim,nand
    nand_ecc                3400  1 nand
    mtd                    15352  5 mtd_blkdevs,nandsim,nand
    # rmmod mtdblock
    ERROR: Module mtdblock is in use
    #

Jarkko Lavinen

                 reply	other threads:[~2010-09-10 11:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20100910110446.GA28045@angel.research.nokia.com \
    --to=jarkko.lavinen@nokia.com \
    --cc=david.woodhouse@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximlevitsky@gmail.com \
    /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

all inboxes | Powered by JetHome®