[Yaffs] Problem with deleted files after unmount/mount

Beat Morf beat.morf at duagon.com
Thu Jun 23 15:15:36 BST 2005


Hi

I am testing YAFFS with the direct implementation on my hardware. All 
work well until I tried following code.


for (j=0; j<2; j++)
{
     h = yaffs_open("/flash/yaffs1", O_CREAT | O_RDWR | O_TRUNC, S_IREAD 
| S_IWRITE);
     if (0 <= h)
     {
         if (200 == yaffs_write(h, buffer, 200))
         {
             if (0 == yaffs_close(h))
             {
                 yaffs_unmount("/flash");
                 yaffs_mount("/flash");
                 if (0 == yaffs_rename("/flash/yaffs1", "/flash/yaffs2"))
                 {
                     if (0 == yaffs_unlink("/flash/yaffs2"))
                     {
                         /* OK */
                         diag_printf("round %d is OK\n", j);
                     }
                     else
                     {
                         diag_printf("unlink error\n");
                     }
                 }
                 else
                 {
                     diag_printf("rename error\n");
                 }
             }
             else
             {
                 diag_printf("close error\n");
             }
         }
         else
         {
             diag_printf("write error\n");
         }
     }
     else
     {
         diag_printf("open error\n");
     }
}

For (j==0) the loop works well and no file called /flash/yaffs1 or 
/flash/yaffs2 is available at the end.
For (j==1) the procedure fails at the function 
yaffs_rename("/flash/yaffs1", "/flash/yaffs2") with the return value 
'-1'. If I list the directory "/flash", I see two files called 
"/flash/yaffs1" and "/flash/yaffs2" !!!

Disabling the procedures 'yaffs_unmount("/flash")' and 
'yaffs_mount("/flash")' will fix the problem!

Does anybody know such a file-problem of unmounting and remounting a 
YAFFS partition during normal operation? (of course in normal operation 
a YAFFS partition is mounting at the beginning and unmounting at the end 
of an application).


Thanks in advance,
Beat Morf






More information about the yaffs mailing list