[Yaffs-archive] [BUG?] & [PATCH] the return of the symlink bug?

Luc Van Oostenryck luc.vanoostenryck@easynet.be
Wed, 20 Nov 2002 21:13:58 +0100


Hi YAFFSer,

Do you remember the symlink problems that Nich have found
some time ago:

	> ln -s old new			# OK
	> rm new			# OK
	> ln -s old new			# ln say OK but ...
	> ls
	new: Not found			# ! entry is deleted
					# but the name still exist 
					# in the directory?
	> cd /
	> umount /yaffs; mount /yaffs	# umount may fail
	> cd yaffs
	> ls
	new

	# the problem is probably related with the dentry(ies)

I think that this problem was never solved because not reproductible.
Well, it happened again to me this afternoon!
The following patch seems to solve the problem:
(same as my old path proposal, same as done in yaffs_mknod,
 same/like done in ext2_symlink):

diff -ur yaffs-cvs/yaffs_fs.c yaffs/yaffs_fs.c
--- yaffs-cvs/yaffs_fs.c	Sun Nov 10 20:54:22 2002
+++ yaffs/yaffs_fs.c	Wed Nov 20 20:51:38 2002
@@ -897,6 +897,11 @@
 
 	if(obj)
 	{
+		struct inode* inode;
+
+		inode = yaffs_get_inode(dir->i_sb, mode, 0, obj);
+		d_instantiate(dentry, inode);
+
 		T((KERN_DEBUG"symlink created OK\n"));
 		return 0;
 	}

BTW, I think that the following patch (or some variant) is necessary:

diff -ur yaffs-cvs/yaffs_fs.c yaffs/yaffs_fs.c
--- yaffs-cvs/yaffs_fs.c	Sun Nov 10 20:54:22 2002
+++ yaffs/yaffs_fs.c	Wed Nov 20 20:53:29 2002
@@ -828,6 +828,7 @@
 	if( retVal == YAFFS_OK)
 	{
 		dentry->d_inode->i_nlink--;
+		mark_inode_dirty(dentry->d_inode);
 		return 0;
 	}
 	else



PS. Apart this little problem YAFFS is working great!
Charles, thank you and succes with YAFFS2.
(Humm, I still need to convince my boss that we/I need a board
 with a 256Mb flash on it :-).

-- 
Luc Van Oostenryck


---------------------------------------------------------------------------------------
This mailing list is hosted by Toby Churchill open software (www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself from the list by 
sending an email to yaffs-request@toby-churchill.org with the text "unsubscribe" 
(without the quotes) as the subject.