From: Holger Brunck <holger.brunck@keymile.com>
To: dedekind@infradead.org
Cc: linux-mtd@lists.infradead.org
Subject: Re: gluebi problems on 2.6.28 backport
Date: Fri, 10 Jul 2009 14:50:29 +0200 [thread overview]
Message-ID: <1247230229.28076.1.camel@pc005093.de.keymile.net> (raw)
In-Reply-To: <1247228821.20721.368.camel@localhost.localdomain>
Hi,
> The problem is that the mtd_blkdevs module does not open MTD devices
> before working with them. Gluebi changes revealed this problem. Below
> is the patch which should fix the issue. Please, try and let me know
> if it helps.
>
> ======================================================================
>
> From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> Subject: [PATCH] mtd: blkdevs: do not for get to get MTD devices
>
> Nowadays MTD devices have to be "get" before they can be
> used. This has to be done with 'put_mtd_device()'. The
> 'blktrans_open()' function did not do this and instead
> used 'try_module_get()'. Fixe this.
>
> Since 'put_mtd_device()' already gets the module, extra
> 'try_module_get()' is not needed.
>
> This fixes oops when one tries to use mtdbloc on tope of
> gluebi.
>
> Reported-by: Holger Brunck <holger.brunck@keymile.com>
> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> ---
> drivers/mtd/mtd_blkdevs.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
> index 1409f01..2f55242 100644
> --- a/drivers/mtd/mtd_blkdevs.c
> +++ b/drivers/mtd/mtd_blkdevs.c
> @@ -139,7 +139,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
> struct mtd_blktrans_ops *tr = dev->tr;
> int ret = -ENODEV;
>
> - if (!try_module_get(dev->mtd->owner))
> + if (!get_mtd_device(NULL, dev->mtd->index))
> goto out;
>
> if (!try_module_get(tr->owner))
> @@ -153,7 +153,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
> ret = 0;
> if (tr->open && (ret = tr->open(dev))) {
> dev->mtd->usecount--;
> - module_put(dev->mtd->owner);
> + put_mtd_device(dev->mtd);
> out_tr:
> module_put(tr->owner);
> }
> @@ -172,7 +172,7 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode)
>
> if (!ret) {
> dev->mtd->usecount--;
> - module_put(dev->mtd->owner);
> + put_mtd_device(dev->mtd);
> module_put(tr->owner);
> }
>
> --
> 1.6.0.6
>
yes this patch solves my problem.
Thanks a lot.
Regards
Holger Brunck
next prev parent reply other threads:[~2009-07-10 12:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-09 15:19 gluebi problems on 2.6.28 backport Holger Brunck
2009-07-10 12:27 ` Artem Bityutskiy
2009-07-10 12:50 ` Holger Brunck [this message]
2009-07-10 12:55 ` Artem Bityutskiy
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=1247230229.28076.1.camel@pc005093.de.keymile.net \
--to=holger.brunck@keymile.com \
--cc=dedekind@infradead.org \
--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