Re: [Yaffs] 2.6.34 yaffs_follow_link problem

Top Page
Attachments:
Message as email
+ (text/plain)
+ 0001-yaffs2-Updates-for-2.6.34.patch (text/x-diff)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
CC: fs p
Subject: Re: [Yaffs] 2.6.34 yaffs_follow_link problem
Hello

I have been sent the attached patch (attached)

I have been struggling to get my test board up and running 2.6.34 and will
test it as soon as I can.

In the mean time others can test this and see if it fixes the problem.


-- Charles

On Monday 09 August 2010 15:11:34 fs p wrote:
> kernel 2.6.34 ; yaffs_guts.c,v 1.79 2009/03/05 01:45:28
> VFS not found the symbol link on yaffs2 file system
>
> #cd /mnt/bin
> #ln -s busybox sl2bbx
> #./sl2bbx
> -sh: ./sl2bbx: not found
> #cd /usr/sbin
> #ln -s nanddump sl2ndmp
> #./sl2ndmp
> -sh: ./sl2ndmp: not found
>
> turn on os trace:
>
> # cd /mnt/bin
> # ./sl2bbx
> [ 1064.080000] yaffs locking
> [ 1064.080000] yaffs locked
> [ 1064.080000] yaffs_lookup for 261:sl2bbx
> [ 1064.080000] yaffs unlocking
> [ 1064.090000] yaffs_lookup found 590
> [ 1064.090000] yaffs_get_inode for object 590
> [ 1064.090000] yaffs_iget for 590
> [ 1064.100000] yaffs locking
> [ 1064.100000] yaffs locked
> [ 1064.100000] yaffs_FillInode mode a1ff uid 0 gid 0 size 7 count 1
> [ 1064.110000] yaffs unlocking
> [ 1064.110000] yaffs_loookup dentry
> [ 1064.120000] yaffs locking
> [ 1064.120000] yaffs locked
> [ 1064.120000] yaffs unlocking
> [ 1064.130000] yaffs locking
> [ 1064.130000] yaffs locked
> [ 1064.130000] yaffs_lookup for 261:`q@sbox            //fisrt 4 byte is wrong
> , right is busybox
> [ 1064.140000] yaffs unlocking
> [ 1064.140000] yaffs_lookup not found
> -sh: ./sl2bbx: not found

>
> in yaffs_follow_link:
>
>     alias = yaffs_GetSymlinkAlias(yaffs_DentryToObject(dentry));    //
> alias  value is busybox

>
>     kfree(alias);    //-----NOTE here ,after free alias, now the memory
> hold alias is    `q@sbox

>
>
> return form yaffs_follow_link ,back to VFS ,and finally goto yaffs_lookup:
>
> in yaffs_lookup:
>
>     T(YAFFS_TRACE_OS,
>       ( "yaffs_lookup for %d:%s\n",
>        yaffs_InodeToObject(dir)->objectId, dentry->d_name.name));

>
>
>     } else {
>         T(YAFFS_TRACE_OS, ( "yaffs_lookup not found\n"));

>
>     }

>
>     //------NOTE HERE dentry->d_name.name is `q@sbox ,so we canot get the
> real yaffs object(which should be busybox)

>
>
>
>
> I think this is a problem of yaffs_follw_link, is there somebody else
> get the same result?
> Charles can you give some tip?
>
> _______________________________________________
> yaffs mailing list
>
> http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs



From dd3068de90e034e998758d0e50855fd309522a4c Mon Sep 17 00:00:00 2001
From: Colin Cross <>
Date: Fri, 12 Mar 2010 19:23:39 -0800
Subject: [PATCH] yaffs2: Updates for 2.6.34

Change-Id: Iacbdc357dfe88545d00a54c5d08176d1b3714f5f
Signed-off-by: Colin Cross <>
---
fs/yaffs2/yaffs_fs.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/fs/yaffs2/yaffs_fs.c b/fs/yaffs2/yaffs_fs.c
index 4c155ae..7a4bee0 100644
--- a/fs/yaffs2/yaffs_fs.c
+++ b/fs/yaffs2/yaffs_fs.c
@@ -51,6 +51,7 @@ extern const char *yaffs_guts_c_version;
#include <linux/interrupt.h>
#include <linux/string.h>
#include <linux/ctype.h>
+#include <linux/namei.h>

#include "asm/div64.h"

@@ -262,6 +263,7 @@ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset,
 static int yaffs_readlink(struct dentry *dentry, char __user *buffer,
                 int buflen);
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13))
+void yaffs_put_link(struct dentry *dentry, struct nameidata *nd, void *alias);
 static void *yaffs_follow_link(struct dentry *dentry, struct nameidata *nd);
 #else
 static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd);
@@ -327,6 +329,9 @@ static const struct inode_operations yaffs_file_inode_operations = {
 static const struct inode_operations yaffs_symlink_inode_operations = {
     .readlink = yaffs_readlink,
     .follow_link = yaffs_follow_link,
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13))
+    .put_link = yaffs_put_link,
+#endif
     .setattr = yaffs_setattr,
 };


@@ -529,7 +534,6 @@ static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd)
     yaffs_GrossLock(dev);


     alias = yaffs_GetSymlinkAlias(yaffs_DentryToObject(dentry));
-
     yaffs_GrossUnlock(dev);


     if (!alias) {
@@ -537,8 +541,13 @@ static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd)
         goto out;
     }


+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13))
+    nd_set_link(nd, alias);
+    ret = (int)alias;
+#else
     ret = vfs_follow_link(nd, alias);
     kfree(alias);
+#endif
 out:
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13))
     return ERR_PTR(ret);
@@ -547,6 +556,12 @@ out:
 #endif
 }


+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13))
+void yaffs_put_link(struct dentry *dentry, struct nameidata *nd, void *alias) {
+    kfree(alias);
+}
+#endif
+
 struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev,
                 yaffs_Object *obj);


--
1.7.1