linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* mtd locking
@ 2016-05-29 13:38 Matthias Auchmann
  2016-05-29 14:23 ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Auchmann @ 2016-05-29 13:38 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org

Hi all!

I have a question - sorry if it turns out to be a beginner's question. I'm using kernel version 3.17, but as far as I can tell my question still applies.

My question is how locking is ensured with MTD. I understand that usually there would only be one file system attached to one mtd partition, but what if I concurrently ran multiple instances of nanddump from userspace? Is MTD thread-safe?

I'm asking since I had an issue where when I called nanddump on two partitions of the same NAND flash simultaneously, the ECC errors would count up for both nanddumps although only one partition had ECC errors. Experimentally adding a mutex to mtdpart.c's part_read() function solved the issue.

I then noticed that quite frequently in the MTD code, ecc_stats are saved, then some reads are performed, and then ecc_stats are compared. No mutex or spinlock or whatever protection is used. Given that the ECC errors can result in -EUCLEAN or a positive bitflip count (then resulting in scrubbing for UBI for example)... I started to feel a little uncomfortable about the whole MTD locking issue.

This is where the question comes from... could anyone shed light on this?

Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-31 18:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-29 13:38 mtd locking Matthias Auchmann
2016-05-29 14:23 ` Richard Weinberger
2016-05-29 15:53   ` Matthias Auchmann
2016-05-29 16:17     ` Richard Weinberger
2016-05-30  9:24       ` Boris Brezillon
2016-05-31 18:11       ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).