[Yaffs] Deleting symlinks on YAFFS1

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Bob Dunlop
Date:  
To: yaffs
Subject: [Yaffs] Deleting symlinks on YAFFS1
Hi,

I'm having problems deleting symbolic links on a YAFFS1 file system using
the latest YAFFS code. This is with a 2.6.36-rc5 kernel but we've seen
the same problem on 2.6.31.

localhost test # ls -l
localhost test # echo hello > x
localhost test # ln -s x y
localhost test # ls -l
-rw-r--r--    1 root     root            6 Oct  4 08:44 x
lrwxrwxrwx    1 root     root            1 Oct  4 08:44 y -> x
localhost test # rm y
rm: cannot remove 'y': Directory not empty
localhost test # 



These are legacy systems in the field and we can't upgrade the file system.
I guess not many people are trying to use YAFFS1 with recent kernels.

Anyway the following patch fixes the problem for me but that TODO comment
suggests that someone with a better knowledge of the system should look at
it. I don't understand why YAFFS_OBJECT_TYPE_FILE was singled out for
special processing under YAFFS1 ?


diff --git a/yaffs2/yaffs_guts.c b/yaffs2/yaffs_guts.c
index 5db3da6..119dc3e 100644
--- a/yaffs2/yaffs_guts.c
+++ b/yaffs2/yaffs_guts.c
@@ -1708,12 +1708,7 @@ static int yaffs_ChangeObjectName(yaffs_Object *obj, yaffs_Object *newDir,
         YBUG();
     }


-    /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */
-    if (obj->myDev->param.isYaffs2)
-        unlinkOp = (newDir == obj->myDev->unlinkedDir);
-    else
-        unlinkOp = (newDir == obj->myDev->unlinkedDir
-                && obj->variantType == YAFFS_OBJECT_TYPE_FILE);
+    unlinkOp = (newDir == obj->myDev->unlinkedDir);


     deleteOp = (newDir == obj->myDev->deletedDir);



-- 
        Bob Dunlop
        Guralp Systems Limited
        http://www.guralp.com