Hi Charles,

On Wed, 31 Jan 2018 at 09:05 Charles Manning <cdhmanning@gmail.com> wrote:
There is already something a bit like that for r/w partitions since Yaffs will, occasionally, rewrite the oldest block and thus force it to refresh.

It sounds like what is needed here are:
1) A bit more active searching for bad pages.
2) Mount flags to allow fix-up for read-only.

I thought I'd just chime in with my 2 cents.

We had a system in the past with similar requirements to this. The trouble is that there are two different ideas for read-only.
1. Read-only in the sense that at no point does anything write to the NAND device. This isn't really a good idea, due to read disturb etc..
2. Read-only in the sense that when userspace goes to open a file for writing, it always response with -EROFS. Whether the underlying NAND gets touched is not really a concern for userspace, as long as the system is reliable.

It would be great if YAFFS had a mode where it still ran all of the sanity checks, including re-writing the oldest block, but never allowed userspace to open files for writing. At the moment as soon as the filesystem is tagged as read-only, the background thread will immediately exit - https://yaffs.net/gitweb/?p=yaffs2.git;a=blob;f=yaffs_vfs_multi.c;h=acb0c4a4a82e726d11fdcd53fdd3d682c9689402;hb=HEAD#l2222

Regards,
Andre