I have tried Andrew's fix.  It worked.  And I also tried to execute "rm -rf  some_folder" in my yaffs2 partition, but I didn't see issues.  Anybody knows what's that issue "rewind" fixed ?  Thanks.
 
Regards,
Yang

2008/11/5 Yang Chen <yangchen.mot@gmail.com>
Andrew, 

Thanks for your info.  I will try the fix.  Btw ,  have you tested below fix with more cases?
I searched archived mails and found an old mailloop regarding the rewind change .  Looks like that was for rm -rf issues of busybox ...

http://aleph1.co.uk/lurker/message/20051105.003401.0b8fec14.en.html

If we removed the "offset = 2;" , will it cause above issue again ? Or do we still need above workaround for the rm -rf issue for now ...As i understood , it was more like a application issue e.g busybox (i didn't check if bb has supported rewind now) , rather than the relatively low level file system issue.

Charles,

Appreciate your comments !


Regards,
Yang


2008/11/5 Andrew McKay <amckay@iders.ca>

yang chen wrote:
McKay,All

Any new update on this issue?  Thanks.  I just came across similar issue in which readdir(..) can't return NULL...causing endless loop...


I just stopped the directory from rewinding if it was read or written.  It would cause a loop where it would continuously rewind if there were more entries than could be buffered in a single read.

Here's  a patch.  Not sure if it'll apply directly to your source, but should give you the idea of how I fixed it.

--- yaffs_fs.c  21 Dec 2007 00:24:37 -0000      1.1.8.1
+++ yaffs_fs.c  5 Sep 2008 19:36:29 -0000       1.1.8.1.24.1
@@ -960,7 +960,7 @@
          readdir, rewind to after the 2 canned entries. */


       if (f->f_version != inode->i_version) {
-               offset = 2;
+               //offset = 2;  //ARG!!! This is causing readdir to infinitely repeat directory listings.  Don't Rewind!

               f->f_pos = offset;
               f->f_version = inode->i_version;
       }

Andrew McKay
Iders Inc.