On Mon, 2010-08-02 at 15:24 -0400, Peter Barada wrote: > 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: > > > [] (unwind_backtrace+0x0/0xdc) from [] (yaffs_WriteNewChunkWithTagsToNAND+0x470/0x5e8) > [] (yaffs_WriteNewChunkWithTagsToNAND+0x470/0x5e8) from [] (yaffs_CheckGarbageCollection+0xa18/0xd08) > [] (yaffs_CheckGarbageCollection+0xa18/0xd08) from [] (yaffs_ResizeFile+0x30/0xe8) > [] (yaffs_ResizeFile+0x30/0xe8) from [] (yaffs_DeleteFile+0x3c/0x188) > [] (yaffs_DeleteFile+0x3c/0x188) from [] (yaffs_GutsInitialise+0x13b0/0x15c8) > [] (yaffs_GutsInitialise+0x13b0/0x15c8) from [] (yaffs_internal_read_super+0x8e0/0xb6c) > [] (yaffs_internal_read_super+0x8e0/0xb6c) from [] (yaffs_internal_read_super_mtd+0x1c/0x2c) > [] (yaffs_internal_read_super_mtd+0x1c/0x2c) from [] (get_sb_bdev+0x114/0x16c) > [] (get_sb_bdev+0x114/0x16c) from [] (yaffs_read_super+0x18/0x20) > [] (yaffs_read_super+0x18/0x20) from [] (vfs_kern_mount+0x4c/0xd0) > [] (vfs_kern_mount+0x4c/0xd0) from [] (do_kern_mount+0x34/0xd8) > [] (do_kern_mount+0x34/0xd8) from [] (do_mount+0x5ec/0x64c) > [] (do_mount+0x5ec/0x64c) from [] (sys_mount+0x84/0xc4) > [] (sys_mount+0x84/0xc4) from [] (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? Ping? > Thanks in advance! > > -- > Peter Barada > Logic Product Development, Inc.