On Tuesday 11 August 2009 14:31:55 Li YingChao-RJN637 wrote: > Test well. Thanks for your quick reply and fix. > > FYI: Maybe we just only do the check in "yaffs_UnlinkWorker", and do NOT > need to change the "yaffs_DeleteDirectory". Only a suggestion. The change in DeleteDirectory is there only because I stripped out common code and made that into a single checking function. I would rather have the checking logic in one place. -- CHarles > > -----Original Message----- > From: Charles Manning [mailto:manningc2@actrix.gen.nz] > Sent: Tuesday, August 11, 2009 9:30 AM > To: yaffs@lists.aleph1.co.uk > Cc: Li YingChao-RJN637 > Subject: Re: [Yaffs] yaffs rmdir issue > > On Monday 10 August 2009 15:14:03 Li YingChao-RJN637 wrote: > > Hi, > > > > When the directory is NOT empty, I try to remove dir by "rmdir" > > command. Normal should return fail, but YAFFS return true. The files > > under this directory is lost, and the file space can not be free. > > Seems "yaffs_UnlinkWorker" don't check if the directory is empty when > > obj->variantType is YAFFS_OBJECT_TYPE_DIRECTORY > > > > # # mount -t yaffs2 /dev/block/mtdblock9 /debug # # cd /debug # # ls > > -l > > drw-rw-rw- root root 1970-01-01 05:31 lost+found > > # # mkdir aaa > > # # cp /data/flash_eraseall aaa > > # # df . > > .: 9216K total, 2780K used, 6436K available (block size 4096) # # ls > > -l > > drwxrwxrwx root root 1970-01-01 05:32 aaa > > drw-rw-rw- root root 1970-01-01 05:31 lost+found > > # # rm aaa > > rm failed for aaa, Is a directory > > # # ls -l aaa > > -rwxrwxrwx root root 1660816 1970-01-01 05:32 flash_eraseall > > # # rmdir aaa > > # # ls -l > > drw-rw-rw- root root 1970-01-01 05:31 lost+found > > # # df . > > .: 9216K total, 2780K used, 6436K available (block size 4096) # # > > > > # /data/busybox uname -a > > Linux localhost 2.6.29-omap1 #1 Sun Aug 2 22:32:04 CDT 2009 armv7l > > unknown > > Thanks for reporting that. > > Get latest cvs. It should work now: > > root@linux-dual-head:/mnt# mkdir d > root@linux-dual-head:/mnt# touch d/f > root@linux-dual-head:/mnt# rmdir d > rmdir: failed to remove `d': Directory not empty > root@linux-dual-head:/mnt# rm d/f root@linux-dual-head:/mnt# rmdir d > root@linux-dual-head:/mnt# > > -- CHarles > > > > _______________________________________________ > yaffs mailing list > yaffs@lists.aleph1.co.uk > http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs