Index: trunk/kernel/vfs/vfs.c
===================================================================
--- trunk/kernel/vfs/vfs.c	(revision 50)
+++ trunk/kernel/vfs/vfs.c	(revision 101)
@@ -246,6 +246,6 @@
 }
 
-/////////////////////////////////////////////////
-void vfs_inode_size_set_size( xptr_t    inode_xp,
+////////////////////////////////////////////
+void vfs_inode_set_size( xptr_t    inode_xp,
                               uint32_t  size )
 {
@@ -260,6 +260,6 @@
 }
 
-///////////////////////////////////////////////
-void vfs_inode_remote_unlock( xptr_t inode_xp )
+////////////////////////////////////////
+void vfs_inode_unlock( xptr_t inode_xp )
 {
     // get inode cluster and local pointer
@@ -271,6 +271,6 @@
 }
 
-/////////////////////////////////////////////
-void vfs_inode_remote_lock( xptr_t inode_xp )
+//////////////////////////////////////
+void vfs_inode_lock( xptr_t inode_xp )
 {
     // get inode cluster and local pointer
@@ -280,4 +280,15 @@
     // get the main lock
     remote_spinlock_lock( XPTR( cxy , &ptr->main_lock ) );
+}
+
+/////////////////////////////////////////
+xptr_t vfs_inode_owner( xptr_t inode_xp )
+{
+    // get inode cluster and local pointer
+    cxy_t         cxy = GET_CXY( inode_xp );
+    vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );
+
+    // get the main lock
+    return remote_spinlock_owner( XPTR( cxy , &ptr->main_lock ) );
 }
 
@@ -459,4 +470,7 @@
     xptr_t        file_xp;      // extended pointer on created file descriptor
     uint32_t      file_id;      // created file descriptor index in reference fd_array
+
+    vfs_dmsg("\n[INFO] %s : enters for <%s> at cycle %d\n",
+             __FUNCTION__ , path , hal_get_cycles() );
 
     // compute lookup working mode
@@ -476,4 +490,7 @@
     // get extended pointer on target inode
     error = vfs_lookup( cwd_xp , path , lookup_mode , &inode_xp );
+
+    vfs_dmsg("\n[INFO] %s : get inode_xp = %l for <%s> at cycle %d\n",
+             __FUNCTION__ , inode_xp , path , hal_get_cycles() );
 
     if( error ) return error;
@@ -848,5 +865,5 @@
 
     // return child inode
-    *child_xp = (xptr_t)hal_remote_lwd( XPTR( dentry_cxy , &dentry_ptr->parent ) );
+    *child_xp = (xptr_t)hal_remote_lwd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) );
     return true;
 }
@@ -903,5 +920,5 @@
 					xptr_t           * inode_xp )
 {
-    char          name[CONFIG_VFS_MAX_NAME_LENGTH];   // one name in path 
+    char               name[CONFIG_VFS_MAX_NAME_LENGTH];   // one name in path 
 
     xptr_t             parent_xp;    // extended pointer on parent inode
@@ -922,4 +939,7 @@
     error_t            error;
 
+    vfs_dmsg("\n[INFO] %s : enters for <%s>\n",
+             __FUNCTION__ , pathname );
+
     this    = CURRENT_THREAD;
     process = this->process;
@@ -929,5 +949,5 @@
     else                     parent_xp = cwd_xp;
 
-    // initialise loop variables
+    // initialise other loop variables
     current  = pathname;
     next     = NULL;
@@ -936,12 +956,15 @@
 
     // take lock on parent inode
-    vfs_inode_remote_lock( parent_xp );
-
-    // break : if one intermediate name not found
-    // exit  : when last name found (i.e. last == true)
+    vfs_inode_lock( parent_xp );
+
+    // load from device if one intermediate node not found
+    // exit  when last name found (i.e. last == true)
     do
     {
-        // get one name from path and the last flag
+        // get one name from path, and the "last" flag
         vfs_get_name_from_path( current , name , &next , &last );
+
+        vfs_dmsg("\n[INFO] %s : looking for node <%s> / last = %d\n",
+                 __FUNCTION__ , name , last );
 
         // search a child dentry matching name for parent inode
@@ -952,6 +975,9 @@
         if( found == false ) // child inode not found in inode tree => try to load it
         {
+            vfs_dmsg("\n[INFO] %s : node <%s> not found, try to load it\n",
+                     __FUNCTION__ , name );
+
             // release lock on parent inode
-            vfs_inode_remote_unlock( parent_xp );
+            vfs_inode_unlock( parent_xp );
 
             // get cluster and local pointer on parent inode
@@ -982,8 +1008,11 @@
 
             // take lock on parent inode
-            vfs_inode_remote_lock( parent_xp );
+            vfs_inode_lock( parent_xp );
         }
 
-        // check access rights
+        vfs_dmsg("\n[INFO] %s : node <%s> found / parent = %l / child = %l / last = %d\n",
+                 __FUNCTION__ , name , parent_xp , child_xp , last );
+
+        // TODO check access rights
         // error = vfs_access_denied( child_xp,
         //                            client_uid,
@@ -995,13 +1024,24 @@
         // }
 
+printk("\n@@@ bloup 0 : parent lock owner = %l / child lock owner = %l\n",
+       vfs_inode_owner( parent_xp ) , vfs_inode_owner( child_xp ) );
+
         // take lock on child inode if not last
-        if( last == false ) vfs_inode_remote_lock( child_xp );
+        if( last == false ) vfs_inode_lock( child_xp );
+
+printk("\n@@@ bloup 1\n");
 
         // release lock on parent inode
-        vfs_inode_remote_unlock( parent_xp );
+        vfs_inode_unlock( parent_xp );
+
+printk("\n@@@ bloup 2\n");
 
         // update loop variables
         parent_xp = child_xp;
         current   = next;
+
+        vfs_dmsg("\n[INFO] %s : complete node <%s> / last = %d\n",
+                 __FUNCTION__ , name , last );
+
     }
     while( last == false );
@@ -1142,5 +1182,5 @@
     uint32_t  y_size    = LOCAL_CLUSTER->y_size;
     uint32_t  y_width   = LOCAL_CLUSTER->y_width;
-    uint32_t  index     = ( hal_time_stamp() + hal_get_gid() ) % (x_size * y_size);
+    uint32_t  index     = ( hal_get_cycles() + hal_get_gid() ) % (x_size * y_size);
     uint32_t  x         = index / y_size;    
     uint32_t  y         = index % y_size;
