I have test this patch, the problem is gone( rmdir ) , but a YBUG come :

 create  a reguar  file test.bin ,  then create a hardlink :
 ln test.bin  foo.bin ,
then delete the test.bin,

NOW:
==>> yaffs bug: fs/yaffs2/yaffs_guts.c 6862



The work flow is  yaffs_DoGenericObjectDeletion-->yaffs_ChangeObjectName--->yaffs_AddObjectToDirectory,
it seems that  ylist_empty(&obj->siblings) ;

BTW ,  I have test the yaffs2 in nandsim  , but the  yaffs_delete_inode page fault not come , why ?



2009/3/5 Charles Manning <manningc2@actrix.gen.nz>
I have done some check ins which should have fixed this issue and the YBUG
issues.

I would really appreciate it if people could pick up those changes and give
some feedback.

What was happening was that the unlink was destroying the object, but this
should have been defered until the delete_object happened. Regular files were
being handled correctly (to handle the case where an unlinked file can still
be live) but other object types were not being handled correctly.

The problem was apparently benign until the extra checking was added.

-- CHarles


On Thursday 05 March 2009 02:15:04 fs p wrote:
> My kenel is 2.6.19 , yaffs is 09-2-24 from cvs
>
> If  I delete a dir named "oop ", use  rmdir cmd , found that:
>
> 1. yaffs_DoGenericObjectDeletion is called (frist time) ,
>                    the oop  is move to yaffs's deletedDir,  now oop's
> parnet is deletedDir , then yaffs_RemoveObjectFromDirectory ( yaffs_gus.c
> :5201 )is called ,  so the  oop 's parnet is NULL;  (
>
> 2. Then in the do_rmdir  function, after the vfs_rmdir , will call   :
>
>  dput ----->yaffs_delete_inode(  from inode get the yaffs_object , but the
> obj's parnet is NULL   )
> --->yaffs_DeleteFile--->yaffs_DoGenericObjectDeletion( second time) , from
> here yaffs complain:
>
> ==>> yaffs bug: fs/yaffs2/yaffs_guts.c 6836
> ==>> yaffs bug: fs/yaffs2/yaffs_guts.c 6763
>
> The problem is    oop->parent=NULL , so run in   yaffs_VerifyDirectory ,
> page fault come.
>
> Any Tips?  I want change the yaffs_delete_inode like this:
>
> yaffs_Object *obj = yaffs_InodeToObject(inode);
>
>     if( obj && obj->parent){
>     dev = obj->myDev;
>         yaffs_GrossLock(dev);
>         yaffs_DeleteFile(obj);
>         yaffs_GrossUnlock(dev);
>
> }