Hi Murali,

Thanks for the patch! This does fix the mount problem for me with 2.4. I had been looking at the iget4 code but its unfamiliar to me. Anyway, thanks for the quick fix!

Walt, I've merge the fixes to your branch as well.

-sam

On Nov 11, 2006, at 4:27 AM, Murali Vilayannur wrote:

Hi Sam, Walt,
Attached patch should fix the mount breakages that you guys noticed on some 2.4 kernels.
Let me know if it still does not fix your problems..
I think this could also be committed if it indeed fixes the problem.
thanks,
Murali
Index: src/kernel/linux-2.6/inode.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/inode.c,v
retrieving revision 1.77
diff -u -r1.77 inode.c
--- src/kernel/linux-2.6/inode.c        4 Nov 2006 07:15:25 -0000       1.77
+++ src/kernel/linux-2.6/inode.c        11 Nov 2006 10:19:01 -0000
@@ -369,13 +369,18 @@
/* the ->set callback of iget5_locked and friends. Sorta equivalent to the ->read_inode()
  * callback if we are using iget and friends
  */
-static int pvfs2_set_inode(struct inode *inode, void *data)
+int pvfs2_set_inode(struct inode *inode, void *data)
 {
     /* callbacks to set inode number handle */
     PVFS_object_ref *ref = (PVFS_object_ref *) data;
     pvfs2_inode_t *pvfs2_inode = NULL;

+    /* Make sure that we have sane parameters */
+    if (!data || !inode)
+        return 0;
     pvfs2_inode = PVFS2_I(inode);
+    if (!pvfs2_inode)
+        return 0;
     pvfs2_inode_initialize(pvfs2_inode);
     pvfs2_inode->refn.fs_id  = ref->fs_id;
     pvfs2_inode->refn.handle = ref->handle;
@@ -443,6 +448,21 @@
         if (inode && (inode->i_state & I_NEW))
         {
             inode->i_ino = hash; /* needed for stat etc */
+ /* iget4_locked and iget_locked dont invoke the set_inode callback. + * So we work around that by stashing the pvfs object reference + * in the inode specific private part for 2.4 kernels and invoking
+             * the setcallback explicitly for 2.6 kernels.
+             */
+#if defined(HAVE_IGET4_LOCKED) || defined(HAVE_IGET_LOCKED)
+            if (PVFS2_I(inode)) {
+                pvfs2_set_inode(inode, ref);
+            }
+            else {
+#ifdef PVFS2_LINUX_KERNEL_2_4
+                inode->u.generic_ip = (void *) ref;
+#endif
+            }
+#endif
             /* issue a call to read the inode */
             sb->s_op->read_inode(inode);
             unlock_new_inode(inode);
Index: src/kernel/linux-2.6/pvfs2-kernel.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2- kernel.h,v
retrieving revision 1.138
diff -u -r1.138 pvfs2-kernel.h
--- src/kernel/linux-2.6/pvfs2-kernel.h 9 Nov 2006 20:29:33 -0000 1.138
+++ src/kernel/linux-2.6/pvfs2-kernel.h 11 Nov 2006 10:19:02 -0000
@@ -734,6 +734,7 @@
 /****************************
  * defined in inode.c
  ****************************/
+int pvfs2_set_inode(struct inode *inode, void *data);
 uint32_t convert_to_pvfs2_mask(unsigned long lite_mask);
 struct inode *pvfs2_get_custom_inode_common(
     struct super_block *sb,
Index: src/kernel/linux-2.6/super.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/super.c,v
retrieving revision 1.87
diff -u -r1.87 super.c
--- src/kernel/linux-2.6/super.c        4 Nov 2006 07:15:25 -0000       1.87
+++ src/kernel/linux-2.6/super.c        11 Nov 2006 10:19:03 -0000
@@ -250,13 +250,18 @@
     struct inode *inode)
 {
     pvfs2_inode_t *pvfs2_inode = NULL;
+    void *ptr = NULL;

+#if !defined(HAVE_IGET4_LOCKED) && !defined(HAVE_IGET_LOCKED)
     if (inode->u.generic_ip)
     {
gossip_err("ERROR! Found an initialized inode in pvfs2_read_inode! "
                     "Should not have been initialized?\n");
         return;
     }
+#else
+    ptr = inode->u.generic_ip;
+#endif

     /* Here we allocate the PVFS2 specific inode structure */
     pvfs2_inode = pvfs2_inode_alloc();
@@ -266,7 +271,15 @@
         inode->u.generic_ip = pvfs2_inode;
         pvfs2_inode->vfs_inode = inode;
         inode->i_flags &= ~(S_APPEND|S_IMMUTABLE|S_NOATIME);
-
+ /* Initialize the handle id to be looked up in the case of iget4_locked + * and iget_locked functions, since they are not done elsewhere
+         */
+#if defined(HAVE_IGET4_LOCKED) || defined(HAVE_IGET_LOCKED)
+        if (ptr == NULL) {
+ gossip_err("Warning! We don't have the reference to the pvfs2 object handle.. using iget4/iget(locked) interface\n");
+        }
+        pvfs2_set_inode(inode, ptr);
+#endif
if (pvfs2_inode_getattr(inode, PVFS_ATTR_SYS_ALL_NOHINT) ! = 0)
         {
             pvfs2_make_bad_inode(inode);

_______________________________________________
Pvfs2-developers mailing list
Pvfs2-developers@beowulf-underground.org
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to