I have a filesystem - I've created it from scratch, copied one file into it, unmounted the filesystem, remounted it and created a new version of the file.  I then reboot and remount the filesystem in read-only, and yaffs attempts to clean up the filesystem by calline yaffs_DeleteFile from yaffs_StripDeletedObjects.

Unfortunately with the filesystem in this state, nandmtd2_WriteChunkWithTagsToNAND is called (and returns -EROFS) which yaffs treats as a write error, tries to retire the block and eventually complains that the allocator is out.

I added a dump_stack into yaffs_VerifyChunkWritten to see how its called from mount on a read-only filesystem and I get:

[<c0037584>] (unwind_backtrace+0x0/0xdc) from [<c0168684>] (yaffs_WriteNewChunkWithTagsToNAND+0x470/0x5e8)
[<c0168684>] (yaffs_WriteNewChunkWithTagsToNAND+0x470/0x5e8) from [<c0169644>] (yaffs_CheckGarbageCollection+0xa18/0xd08)
[<c0169644>] (yaffs_CheckGarbageCollection+0xa18/0xd08) from [<c016ab2c>] (yaffs_ResizeFile+0x30/0xe8)
[<c016ab2c>] (yaffs_ResizeFile+0x30/0xe8) from [<c016ae10>] (yaffs_DeleteFile+0x3c/0x188)
[<c016ae10>] (yaffs_DeleteFile+0x3c/0x188) from [<c016d9cc>] (yaffs_GutsInitialise+0x13b0/0x15c8)
[<c016d9cc>] (yaffs_GutsInitialise+0x13b0/0x15c8) from [<c0163df0>] (yaffs_internal_read_super+0x8e0/0xb6c)
[<c0163df0>] (yaffs_internal_read_super+0x8e0/0xb6c) from [<c01640c4>] (yaffs_internal_read_super_mtd+0x1c/0x2c)
[<c01640c4>] (yaffs_internal_read_super_mtd+0x1c/0x2c) from [<c00b1794>] (get_sb_bdev+0x114/0x16c)
[<c00b1794>] (get_sb_bdev+0x114/0x16c) from [<c01613f8>] (yaffs_read_super+0x18/0x20)
[<c01613f8>] (yaffs_read_super+0x18/0x20) from [<c00b0814>] (vfs_kern_mount+0x4c/0xd0)
[<c00b0814>] (vfs_kern_mount+0x4c/0xd0) from [<c00b08dc>] (do_kern_mount+0x34/0xd8)
[<c00b08dc>] (do_kern_mount+0x34/0xd8) from [<c00c4fdc>] (do_mount+0x5ec/0x64c)
[<c00c4fdc>] (do_mount+0x5ec/0x64c) from [<c00c50c0>] (sys_mount+0x84/0xc4)
[<c00c50c0>] (sys_mount+0x84/0xc4) from [<c0031ec0>] (ret_fast_syscall+0x0/0x2c)
**>> Block 5 needs retiring

If I mount the filesystem read-write, then its cleaned up.  So the question is, how can I fix YAFFS such that it doesn't attempt to write to a read-only filesystem?

Thanks in advance!

--
Peter Barada <peterb@logicpd.com>
Logic Product Development, Inc.