aboutsummaryrefslogtreecommitdiff
blob: 28f02823ce84143aeb40616c286c75b12917c139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
From c3b73bfe1e157ec42be9015d231da66808483554 Mon Sep 17 00:00:00 2001
From: Peng Tao <tao.peng@emc.com>
Date: Thu, 23 Aug 2012 13:55:46 +0800
Subject: [PATCH 13/13] LU-1337 kernel: 3.5 kernel encode_fh passes in parent
 inode

Changed by upsteam commit b0b0382b.

Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: I6d7223b934bfe4151371744ad72bdab6b170c700
---
 lustre/autoconf/lustre-core.m4 | 30 ++++++++++++++++++++++++++++++
 lustre/llite/llite_nfs.c       |  6 ++++++
 2 files changed, 36 insertions(+)

diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index 3f47dab..dbf7233 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -2066,6 +2066,35 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 3.5 encode_fh has parent inode passed in directly
+# see kernel commit b0b0382b
+#
+AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT],
+[AC_MSG_CHECKING([if encode_fh have parent inode as parameter])
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_LINUX_TRY_COMPILE([
+	#include <linux/exportfs.h>
+	#include <linux/fs.h>
+	#include <linux/types.h>
+	int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode*p)
+	{
+		return 0;
+	}
+],[
+	struct export_operations exp_op;
+	exp_op.encode_fh = ll_encode_fh;
+],[
+	AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
+		  [have parent inode as parameter])
+	AC_MSG_RESULT([yes])
+],[
+	AC_MSG_RESULT([no])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+])
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -2231,6 +2260,7 @@ AC_DEFUN([LC_PROG_LINUX],
 
 	 # 3.5
 	 LC_HAVE_CLEAR_INODE
+	 LC_HAVE_ENCODE_FH_PARENT
 
          #
          if test x$enable_server = xyes ; then
diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c
index 809a564..ba4f9f1 100644
--- a/lustre/llite/llite_nfs.c
+++ b/lustre/llite/llite_nfs.c
@@ -173,11 +173,17 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren
  * 2 -- contains child file handle and parent file handle;
  * 255 -- error.
  */
+#ifndef HAVE_ENCODE_FH_PARENT
 static int ll_encode_fh(struct dentry *de, __u32 *fh, int *plen,
                         int connectable)
 {
         struct inode *inode = de->d_inode;
         struct inode *parent = de->d_parent->d_inode;
+#else
+static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen,
+                        struct inode *parent)
+{
+#endif
         struct lustre_nfs_fid *nfs_fid = (void *)fh;
         ENTRY;
 
-- 
1.7.12