From: Artem Bityutskiy <dedekind@infradead.org>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] [MTD] NAND: fix race in nand_base
Date: Mon, 23 Jul 2007 14:17:26 +0300 [thread overview]
Message-ID: <1185189446.25822.5.camel@sauron> (raw)
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Date: Mon, 23 Jul 2007 16:06:50 +0300
Subject: [PATCH] [MTD] NAND: fix race in nand_base
When we mark block bad we have to get chip because this involves
writing to the page's OOB. We hit this bug in UBI - we observed
random obscure crashes when it marks block bad from the background
thread and there is some parallel task which utilizes flash.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
drivers/mtd/nand/nand_base.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 7e68203..3391b05 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -348,6 +348,8 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
uint8_t buf[2] = { 0, 0 };
int block, ret;
+ nand_get_device(chip, mtd, FL_READING);
+
/* Get block number */
block = (int)(ofs >> chip->bbt_erase_shift);
if (chip->bbt)
@@ -370,6 +372,8 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
}
if (!ret)
mtd->ecc_stats.badblocks++;
+
+ nand_release_device(mtd);
return ret;
}
--
1.5.0.6
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
next reply other threads:[~2007-07-23 11:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 11:17 Artem Bityutskiy [this message]
2007-07-23 11:22 ` [PATCH] [MTD] NAND: fix race in nand_base 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=1185189446.25822.5.camel@sauron \
--to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.