mtd locking

Richard Weinberger richard.weinberger at gmail.com
Sun May 29 07:23:55 PDT 2016


On Sun, May 29, 2016 at 3:38 PM, Matthias Auchmann <m.auchmann at artech.at> wrote:
> 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.

IIRC ECC error counting is not thread safe at all.
So, yes the behavior is indented.
...at least nobody cared enough to make it better.

-- 
Thanks,
//richard



More information about the linux-mtd mailing list