Hello,
Apologies for the duplicate effort, if someone already got or is
actively working on fixing NFS exports off pvfs2 volumes.
I havent been following pvfs2 list that closely over the last several months.
Patch is against HEAD and I got it to work on on Ubuntu 64 running 2.6.24..
Emmanuel, let me know if this fixes the problem on your kernel. It may
or may not build since some of these
function callbacks are probably only available on newer kernels.
Best wishes,
Murali
Index: configure
===================================================================
RCS file: /anoncvs/pvfs2/configure,v
retrieving revision 1.391
diff -u -r1.391 configure
--- configure 17 Apr 2008 20:50:17 -0000 1.391
+++ configure 1 Jun 2008 04:22:52 -0000
@@ -10683,6 +10683,122 @@
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { echo "$as_me:$LINENO: checking for fh_to_dentry member in export_operations in kernel" >&5
+echo $ECHO_N "checking for fh_to_dentry member in export_operations in kernel... $ECHO_C" >&6; }
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #define __KERNEL__
+ #include <linux/exportfs.h>
+
+int
+main ()
+{
+
+ struct export_operations x;
+ x.fh_to_dentry = NULL;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_FHTODENTRY_EXPORT_OPERATIONS 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ { echo "$as_me:$LINENO: checking for encode_fh member in export_operations in kernel" >&5
+echo $ECHO_N "checking for encode_fh member in export_operations in kernel... $ECHO_C" >&6; }
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #define __KERNEL__
+ #include <linux/exportfs.h>
+
+int
+main ()
+{
+
+ struct export_operations x;
+ x.encode_fh = NULL;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENCODEFH_EXPORT_OPERATIONS 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
{ echo "$as_me:$LINENO: checking for second arg type int in address_space_operations releasepage" >&5
echo $ECHO_N "checking for second arg type int in address_space_operations releasepage... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
Index: pvfs2-config.h.in
===================================================================
RCS file: /anoncvs/pvfs2/pvfs2-config.h.in,v
retrieving revision 1.118
diff -u -r1.118 pvfs2-config.h.in
--- pvfs2-config.h.in 11 Apr 2008 17:05:24 -0000 1.118
+++ pvfs2-config.h.in 1 Jun 2008 04:22:52 -0000
@@ -58,6 +58,9 @@
/* Define if super_operations statfs has dentry argument */
#undef HAVE_DENTRY_STATFS_SOP
+/* Define if export_operations has an encode_fh member */
+#undef HAVE_ENCODEFH_EXPORT_OPERATIONS
+
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
@@ -69,6 +72,9 @@
/* Define if system provides fgtxattr prototype */
#undef HAVE_FGETXATTR_PROTOTYPE
+
+/* Define if export_operations has an fh_to_dentry member */
+#undef HAVE_FHTODENTRY_EXPORT_OPERATIONS
/* Define if struct inode_operations in kernel has fill_handle callback */
#undef HAVE_FILL_HANDLE_INODE_OPERATIONS
Index: maint/config/kernel.m4
===================================================================
RCS file: /anoncvs/pvfs2/maint/config/kernel.m4,v
retrieving revision 1.57
diff -u -r1.57 kernel.m4
--- maint/config/kernel.m4 11 Apr 2008 17:05:25 -0000 1.57
+++ maint/config/kernel.m4 1 Jun 2008 04:22:53 -0000
@@ -659,6 +659,32 @@
AC_MSG_RESULT(no)
)
+ AC_MSG_CHECKING(for fh_to_dentry member in export_operations in kernel)
+ AC_TRY_COMPILE([
+ #define __KERNEL__
+ #include <linux/exportfs.h>
+ ], [
+ struct export_operations x;
+ x.fh_to_dentry = NULL;
+ ],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_FHTODENTRY_EXPORT_OPERATIONS, 1, Define if export_operations has an fh_to_dentry member),
+ AC_MSG_RESULT(no)
+ )
+
+ AC_MSG_CHECKING(for encode_fh member in export_operations in kernel)
+ AC_TRY_COMPILE([
+ #define __KERNEL__
+ #include <linux/exportfs.h>
+ ], [
+ struct export_operations x;
+ x.encode_fh = NULL;
+ ],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ENCODEFH_EXPORT_OPERATIONS, 1, Define if export_operations has an encode_fh member),
+ AC_MSG_RESULT(no)
+ )
+
dnl Using -Werror is not an option, because some arches throw lots of
dnl warnings that would trigger false negatives. We know that the
dnl change to the releasepage() function signature was accompanied by
Index: src/kernel/linux-2.6/inode.c
===================================================================
RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/inode.c,v
retrieving revision 1.83
diff -u -r1.83 inode.c
--- src/kernel/linux-2.6/inode.c 19 May 2008 17:51:20 -0000 1.83
+++ src/kernel/linux-2.6/inode.c 1 Jun 2008 04:22:53 -0000
@@ -483,6 +483,8 @@
}
#endif
}
+ gossip_debug(GOSSIP_INODE_DEBUG, "iget handle %llu, fsid %d hash %ld i_ino %lu\n",
+ ref->handle, ref->fs_id, hash, inode->i_ino);
return inode;
}
Index: src/kernel/linux-2.6/super.c
===================================================================
RCS file: /anoncvs/pvfs2/src/kernel/linux-2.6/super.c,v
retrieving revision 1.100
diff -u -r1.100 super.c
--- src/kernel/linux-2.6/super.c 13 May 2008 18:18:41 -0000 1.100
+++ src/kernel/linux-2.6/super.c 1 Jun 2008 04:22:54 -0000
@@ -967,6 +967,8 @@
root_object.handle = PVFS2_SB(sb)->root_handle;
root_object.fs_id = PVFS2_SB(sb)->fs_id;
+ gossip_debug(GOSSIP_SUPER_DEBUG, "get inode %llu, fsid %d\n",
+ root_object.handle, root_object.fs_id);
/* alloc and initialize our root directory inode by explicitly requesting
* the sticky bit to be set */
root = pvfs2_get_custom_core_inode(
@@ -1027,7 +1029,105 @@
#else /* !PVFS2_LINUX_KERNEL_2_4 */
-static struct export_operations pvfs2_export_ops = {};
+struct dentry *
+pvfs2_fh_to_dentry(struct super_block *sb, struct fid *fid,
+ int fh_len, int fh_type)
+{
+ PVFS_object_ref refn;
+ struct inode *inode;
+ struct dentry *dentry;
+
+ if (fh_len < 3 || fh_type > 2)
+ {
+ return NULL;
+ }
+
+ refn.handle = (u64) (fid->raw[0]) << 32;
+ refn.handle |= (u32) fid->raw[1];
+ refn.fs_id = (u32) fid->raw[2];
+ gossip_debug(GOSSIP_SUPER_DEBUG, "fh_to_dentry: handle %llu, fs_id %d\n",
+ refn.handle, refn.fs_id);
+
+ inode = pvfs2_iget(sb, &refn);
+ if (inode == NULL)
+ {
+ return ERR_PTR(-ESTALE);
+ }
+ if (IS_ERR(inode))
+ {
+ return (void *) inode;
+ }
+ dentry = d_alloc_anon(inode);
+
+ if (dentry == NULL)
+ {
+ iput(inode);
+ return ERR_PTR(-ENOMEM);
+ }
+ dentry->d_op = &pvfs2_dentry_operations;
+ return dentry;
+}
+
+int pvfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, int connectable)
+{
+ struct inode *inode = dentry->d_inode;
+ int len = *max_len;
+ int type = 1;
+ PVFS_object_ref handle;
+ u32 generation;
+
+ /*
+ * if connectable is specified, parent handle identity has to be stashed
+ * as well.
+ */
+ if (len < 3 || (connectable && len < 6)) {
+ gossip_lerr("fh buffer is too small for encoding\n");
+ type = 255;
+ goto out;
+ }
+
+ handle = PVFS2_I(inode)->refn;
+ generation = inode->i_generation;
+ gossip_debug(GOSSIP_SUPER_DEBUG, "Encoding fh: handle %llu, gen %u, fsid %u\n",
+ handle.handle, generation, handle.fs_id);
+
+ len = 3;
+ fh[0] = handle.handle >> 32;
+ fh[1] = handle.handle & 0xffffffff;
+ fh[2] = handle.fs_id;
+
+ if (connectable && !S_ISDIR(inode->i_mode)) {
+ struct inode *parent;
+
+ spin_lock(&dentry->d_lock);
+
+ parent = dentry->d_parent->d_inode;
+ handle = PVFS2_I(parent)->refn;
+ generation = parent->i_generation;
+ fh[3] = handle.handle >> 32;
+ fh[4] = handle.handle & 0xffffffff;
+ fh[5] = handle.fs_id;
+
+ spin_unlock(&dentry->d_lock);
+ len = 6;
+ type = 2;
+ gossip_debug(GOSSIP_SUPER_DEBUG, "Encoding parent: handle %llu, gen %u, fsid %u\n",
+ handle.handle, generation, handle.fs_id);
+ }
+ *max_len = len;
+
+out:
+ return type;
+}
+
+static struct export_operations pvfs2_export_ops = {
+#ifdef HAVE_ENCODEFH_EXPORT_OPERATIONS
+ .encode_fh = pvfs2_encode_fh,
+#endif
+#ifdef HAVE_FHTODENTRY_EXPORT_OPERATIONS
+ .fh_to_dentry = pvfs2_fh_to_dentry,
+#endif
+};
int pvfs2_fill_sb(
struct super_block *sb,
@@ -1087,6 +1187,8 @@
root_object.handle = PVFS2_SB(sb)->root_handle;
root_object.fs_id = PVFS2_SB(sb)->fs_id;
+ gossip_debug(GOSSIP_SUPER_DEBUG, "get inode %llu, fsid %d\n",
+ root_object.handle, root_object.fs_id);
/* alloc and initialize our root directory inode. be explicit about sticky
* bit */
root = pvfs2_get_custom_core_inode(sb, NULL, (S_IFDIR | 0755 | S_ISVTX),
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers