Gentoo Archives: gentoo-commits

From: Alexey Shvetsov <alexxy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sys-cluster/lustre/, sys-cluster/lustre/files/
Date: Wed, 06 Mar 2013 12:37:15
Message-Id: 1362573407.d4478dc0858706f25c607883239e7ce8d6b616fd.alexxy@gentoo
1 commit: d4478dc0858706f25c607883239e7ce8d6b616fd
2 Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 6 12:36:47 2013 +0000
4 Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 6 12:36:47 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=d4478dc0
7
8 Add patches for kernels 3.7 and 3.8
9
10 Package-Manager: portage-2.2.0_alpha166
11
12 ---
13 sys-cluster/lustre/ChangeLog | 9 +
14 ...ld-check-header-files-in-generated-uapi-d.patch | 161 ++++++++++++++
15 ...-kernel-3.7-kernel-posix-acl-needs-userns.patch | 120 +++++++++++
16 ...3-LU-2850-kernel-3.7-uneports-sock_map_fd.patch | 121 +++++++++++
17 ...rnel-3.7-get-putname-uses-struct-filename.patch | 226 ++++++++++++++++++++
18 ...50-kernel-3.8-upstream-removes-vmtruncate.patch | 82 +++++++
19 sys-cluster/lustre/lustre-9999.ebuild | 8 +
20 7 files changed, 727 insertions(+), 0 deletions(-)
21
22 diff --git a/sys-cluster/lustre/ChangeLog b/sys-cluster/lustre/ChangeLog
23 index 3791ff7..1295495 100644
24 --- a/sys-cluster/lustre/ChangeLog
25 +++ b/sys-cluster/lustre/ChangeLog
26 @@ -2,6 +2,15 @@
27 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
28 # $Header: $
29
30 + 06 Mar 2013; Alexey Shvetsov <alexxy@g.o>
31 + +files/0001-LU-2850-build-check-header-files-in-generated-uapi-d.patch,
32 + +files/0002-LU-2850-kernel-3.7-kernel-posix-acl-needs-userns.patch,
33 + +files/0003-LU-2850-kernel-3.7-uneports-sock_map_fd.patch,
34 + +files/0004-LU-2850-kernel-3.7-get-putname-uses-struct-filename.patch,
35 + +files/0005-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch,
36 + lustre-9999.ebuild:
37 + Add patches for kernels 3.7 and 3.8
38 +
39 10 Feb 2013; Alexey Shvetsov <alexxy@g.o>
40 -files/2.4/0001-LU-1994-llite-atomic_open-support.patch, lustre-9999.ebuild,
41 metadata.xml:
42
43 diff --git a/sys-cluster/lustre/files/0001-LU-2850-build-check-header-files-in-generated-uapi-d.patch b/sys-cluster/lustre/files/0001-LU-2850-build-check-header-files-in-generated-uapi-d.patch
44 new file mode 100644
45 index 0000000..c91788c
46 --- /dev/null
47 +++ b/sys-cluster/lustre/files/0001-LU-2850-build-check-header-files-in-generated-uapi-d.patch
48 @@ -0,0 +1,161 @@
49 +From 26da95a5b9e0502b1001211370fa01ad17f8ef74 Mon Sep 17 00:00:00 2001
50 +From: Peng Tao <tao.peng@×××.com>
51 +Date: Wed, 27 Feb 2013 18:29:34 +0800
52 +Subject: [PATCH 1/5] LU-2850 build: check header files in generated uapi dir
53 +
54 +Upstream moved UAPI headers into generated/uapi directory since
55 +v3.7. We need to check/include necessary header files there.
56 +
57 +Signed-off-by: Peng Tao <tao.peng@×××.com>
58 +Change-Id: Ib104919189ebc0af7d3b5e9ca3b866b3b98be3dc
59 +---
60 + autoMakefile.am | 2 +-
61 + build/autoconf/lustre-build-linux.m4 | 14 ++++++++------
62 + ldiskfs/config/ldiskfs-build.m4 | 14 ++++++++------
63 + lustre/autoconf/lustre-core.m4 | 2 +-
64 + lustre/scripts/version_tag.pl | 1 +
65 + 5 files changed, 19 insertions(+), 14 deletions(-)
66 +
67 +diff --git a/autoMakefile.am b/autoMakefile.am
68 +index 883d13c..8f3518b 100644
69 +--- a/autoMakefile.am
70 ++++ b/autoMakefile.am
71 +@@ -84,7 +84,7 @@ all-am: modules
72 + modules: $(DEP) all-sources
73 + $(MAKE) CC="$(CC)" -C $(LINUX_OBJ) \
74 + -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
75 +- LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -include $(CONFIG_INCLUDE)' \
76 ++ LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -I$$(srctree)/arch/$$(SRCARCH)/include/generated/uapi -I$$(srctree)/arch/$$(SRCARCH)/include/uapi -Iinclude -Iinclude/uapi -Iinclude/generated -Iinclude/generated/uapi $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -include $(CONFIG_INCLUDE)' \
77 + $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
78 + include/config/MARKER $@
79 + endif # LINUX
80 +diff --git a/build/autoconf/lustre-build-linux.m4 b/build/autoconf/lustre-build-linux.m4
81 +index db58704..15e2aa0 100644
82 +--- a/build/autoconf/lustre-build-linux.m4
83 ++++ b/build/autoconf/lustre-build-linux.m4
84 +@@ -44,7 +44,7 @@ AC_MSG_CHECKING([for Linux release])
85 + if test -s $LINUX_OBJ/include/$AUTOCONF_HDIR/utsrelease.h ; then
86 + LINUXRELEASEHEADER=$AUTOCONF_HDIR/utsrelease.h
87 + else
88 +- LINUXRELEASEHEADER=linux/version.h
89 ++ LINUXRELEASEHEADER=$LINUXVERSION_HDIR/version.h
90 + fi
91 + LB_LINUX_TRY_MAKE([
92 + #include <$LINUXRELEASEHEADER>
93 +@@ -96,7 +96,7 @@ AC_SUBST(RELEASE)
94 + # check is redhat/suse kernels
95 + AC_MSG_CHECKING([that RedHat kernel])
96 + LB_LINUX_TRY_COMPILE([
97 +- #include <linux/version.h>
98 ++ #include <$LINUXVERSION_HDIR/version.h>
99 + ],[
100 + #ifndef RHEL_RELEASE_CODE
101 + #error "not redhat kernel"
102 +@@ -222,8 +222,10 @@ LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],[AUTOCONF_HDIR=generated
103 + [LB_CHECK_FILE([$LINUX_OBJ/include/linux/autoconf.h],[AUTOCONF_HDIR=linux],
104 + [AC_MSG_ERROR([Run make config in $LINUX.])])])
105 + AC_SUBST(AUTOCONF_HDIR)
106 +-LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h],[],
107 +- [AC_MSG_ERROR([Run make config in $LINUX.])])
108 ++LB_CHECK_FILE([$LINUX_OBJ/include/generated/uapi/linux/version.h],[LINUXVERSION_HDIR=generated/uapi/linux],
109 ++ [LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h],[LINUXVERSION_HDIR=linux],
110 ++ [AC_MSG_ERROR([Run make config in $LINUX.])])])
111 ++ AC_SUBST(LINUXVERSION_HDIR)
112 +
113 + # ----------- kconfig.h exists ---------------
114 + # kernel 3.1, $LINUX/include/linux/kconfig.h is added
115 +@@ -240,7 +242,7 @@ LB_CHECK_FILE([$LINUX_OBJ/include/linux/kconfig.h],
116 + # tarred up the tree and ran make dep etc. in it, then
117 + # version.h gets overwritten with a standard linux one.
118 +
119 +-if grep rhconfig $LINUX_OBJ/include/linux/version.h >/dev/null ; then
120 ++if grep rhconfig $LINUX_OBJ/include/$LINUXVERSION_HDIR/version.h >/dev/null ; then
121 + # This is a clean kernel-source tree, we need to
122 + # enable extensive workarounds to get this to build
123 + # modules
124 +@@ -350,7 +352,7 @@ $2
125 + AC_DEFUN([LB_LINUX_COMPILE_IFELSE],
126 + [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
127 + rm -f build/conftest.o build/conftest.mod.c build/conftest.ko
128 +-AS_IF([AC_TRY_COMMAND(cp conftest.c build && make -d [$2] ${LD:+"LD=$LD"} CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG LINUXINCLUDE="$EXTRA_LNET_INCLUDE -I$LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -I$LINUX/arch/`echo $target_cpu|sed -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include/generated -I$LINUX_OBJ/include -I$LINUX/include -I$LINUX_OBJ/include2 -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
129 ++AS_IF([AC_TRY_COMMAND(cp conftest.c build && make -d [$2] ${LD:+"LD=$LD"} CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG LINUXINCLUDE="$EXTRA_LNET_INCLUDE -I$LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -I$LINUX/arch/`echo $target_cpu|sed -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include/generated -I$LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include/uapi -I$LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include/generated/uapi -I$LINUX_OBJ/include -I$LINUX/include -I$LINUX_OBJ/include2 -I$LINUX/include/uapi -I$LINUX/include/generated/uapi -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
130 + [$4],
131 + [_AC_MSG_LOG_CONFTEST
132 + m4_ifvaln([$5],[$5])dnl])
133 +diff --git a/ldiskfs/config/ldiskfs-build.m4 b/ldiskfs/config/ldiskfs-build.m4
134 +index fd0f6d2..d657399 100644
135 +--- a/ldiskfs/config/ldiskfs-build.m4
136 ++++ b/ldiskfs/config/ldiskfs-build.m4
137 +@@ -1,11 +1,11 @@
138 + AC_DEFUN([LDISKFS_AC_LINUX_VERSION], [
139 + AC_MSG_CHECKING([kernel source version])
140 +
141 +- utsrelease1=${LINUX_OBJ}/include/linux/version.h
142 ++ utsrelease1=${LINUX_OBJ}/include/$LINUXVERSION_HDIR/version.h
143 + utsrelease2=${LINUX_OBJ}/include/linux/utsrelease.h
144 + utsrelease3=${LINUX_OBJ}/include/generated/utsrelease.h
145 + AS_IF([test -r ${utsrelease1} && fgrep -q UTS_RELEASE ${utsrelease1}], [
146 +- utsrelease=linux/version.h
147 ++ utsrelease=$LINUXVERSION_HDIR/version.h
148 + ], [test -r ${utsrelease2} && fgrep -q UTS_RELEASE ${utsrelease2}], [
149 + utsrelease=linux/utsrelease.h
150 + ], [test -r ${utsrelease3} && fgrep -q UTS_RELEASE ${utsrelease3}], [
151 +@@ -64,7 +64,7 @@ AC_SUBST(RELEASE)
152 + # check is redhat/suse kernels
153 + AC_MSG_CHECKING([that RedHat kernel])
154 + LB_LINUX_TRY_COMPILE([
155 +- #include <linux/version.h>
156 ++ #include <$LINUXVERSION_HDIR/version.h>
157 + ],[
158 + #ifndef RHEL_RELEASE_CODE
159 + #error "not redhat kernel"
160 +@@ -190,8 +190,10 @@ LB_CHECK_FILE([$LINUX_OBJ/include/generated/autoconf.h],[AUTOCONF_HDIR=generated
161 + [LB_CHECK_FILE([$LINUX_OBJ/include/linux/autoconf.h],[AUTOCONF_HDIR=linux],
162 + [AC_MSG_ERROR([Run make config in $LINUX.])])])
163 + AC_SUBST(AUTOCONF_HDIR)
164 +-LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h],[],
165 +- [AC_MSG_ERROR([Run make config in $LINUX.])])
166 ++LB_CHECK_FILE([$LINUX_OBJ/include/generated/uapi/linux/version.h],[LINUXVERSION_HDIR=generated/uapi/linux],
167 ++ [LB_CHECK_FILE([$LINUX_OBJ/include/linux/version.h],[LINUXVERSION_HDIR=linux],
168 ++ [AC_MSG_ERROR([Run make config in $LINUX.])])])
169 ++ AC_SUBST(LINUXVERSION_HDIR)
170 +
171 + # ----------- kconfig.h exists ---------------
172 + # kernel 3.1, $LINUX/include/linux/kconfig.h is added
173 +@@ -208,7 +210,7 @@ LB_CHECK_FILE([$LINUX_OBJ/include/linux/kconfig.h],
174 + # tarred up the tree and ran make dep etc. in it, then
175 + # version.h gets overwritten with a standard linux one.
176 +
177 +-if grep rhconfig $LINUX_OBJ/include/linux/version.h >/dev/null ; then
178 ++if grep rhconfig $LINUX_OBJ/include/$LINUXVERSION_HDIR/version.h >/dev/null ; then
179 + # This is a clean kernel-source tree, we need to
180 + # enable extensive workarounds to get this to build
181 + # modules
182 +diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
183 +index f290ea2..898f2c7 100644
184 +--- a/lustre/autoconf/lustre-core.m4
185 ++++ b/lustre/autoconf/lustre-core.m4
186 +@@ -319,7 +319,7 @@ AC_DEFUN([LC_BIT_SPINLOCK_H],
187 + AC_DEFUN([LC_CONST_ACL_SIZE],
188 + [AC_MSG_CHECKING([calc acl size])
189 + tmp_flags="$CFLAGS"
190 +-CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 -I$LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -include $AUTOCONF_HDIR/autoconf.h $EXTRA_KCFLAGS"
191 ++CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include/uapi -I$LINUX_OBJ/include2 -I$LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -I $LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include/uapi -include $AUTOCONF_HDIR/autoconf.h $EXTRA_KCFLAGS"
192 + AC_TRY_RUN([
193 + #define __KERNEL__
194 + #include <linux/types.h>
195 +diff --git a/lustre/scripts/version_tag.pl b/lustre/scripts/version_tag.pl
196 +index 61796c9..942e54f 100644
197 +--- a/lustre/scripts/version_tag.pl
198 ++++ b/lustre/scripts/version_tag.pl
199 +@@ -45,6 +45,7 @@ sub get_kernver($$)
200 + my $ver = new IO::File;
201 + if (!$ver->open("$objdir/include/linux/utsrelease.h") &&
202 + !$ver->open("$objdir/include/linux/version.h") &&
203 ++ !$ver->open("$objdir/include/generated/uapi/linux/version.h") &&
204 + !$ver->open("$dir/include/linux/utsrelease.h") &&
205 + !$ver->open("$dir/include/linux/version.h")) {
206 + die "Run make dep on '$dir'\n";
207 +--
208 +1.8.1.5
209 +
210
211 diff --git a/sys-cluster/lustre/files/0002-LU-2850-kernel-3.7-kernel-posix-acl-needs-userns.patch b/sys-cluster/lustre/files/0002-LU-2850-kernel-3.7-kernel-posix-acl-needs-userns.patch
212 new file mode 100644
213 index 0000000..5ff415f
214 --- /dev/null
215 +++ b/sys-cluster/lustre/files/0002-LU-2850-kernel-3.7-kernel-posix-acl-needs-userns.patch
216 @@ -0,0 +1,120 @@
217 +From b73192ab79f853231de5809ff40e4fd269060247 Mon Sep 17 00:00:00 2001
218 +From: Peng Tao <tao.peng@×××.com>
219 +Date: Tue, 26 Feb 2013 16:31:44 +0800
220 +Subject: [PATCH 2/5] LU-2850 kernel: 3.7 kernel posix acl needs userns
221 +
222 +With upstream commit 5f3a4a28, kernel posix acl adds support
223 +to user namespace.
224 +
225 +Signed-off-by: Peng Tao <tao.peng@×××.com>
226 +Change-Id: I7d82c51c482daae8a7dbb526b8d72eea2bcf0650
227 +---
228 + lustre/autoconf/lustre-core.m4 | 25 +++++++++++++++++++++++++
229 + lustre/include/liblustre.h | 11 ++++++++++-
230 + lustre/llite/xattr.c | 6 +++++-
231 + lustre/mdc/mdc_request.c | 6 +++++-
232 + 4 files changed, 45 insertions(+), 3 deletions(-)
233 +
234 +diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
235 +index 898f2c7..f424f87 100644
236 +--- a/lustre/autoconf/lustre-core.m4
237 ++++ b/lustre/autoconf/lustre-core.m4
238 +@@ -2213,6 +2213,28 @@ LB_LINUX_TRY_COMPILE([
239 + ])
240 +
241 + #
242 ++# 3.7 posix acl supports user ns
243 ++# see upstream commit 5f3a4a28
244 ++#
245 ++AC_DEFUN([LC_HAVE_POSIX_ACL_NAMESPACE],
246 ++[AC_MSG_CHECKING([if posix acl supports user namespace])
247 ++LB_LINUX_TRY_COMPILE([
248 ++ #include <linux/fs.h>
249 ++ #include <linux/posix_acl_xattr.h>
250 ++ #include <linux/user_namespace.h>
251 ++],[
252 ++ struct user_namespace *user_ns;
253 ++ posix_acl_from_xattr(user_ns, NULL, 0);
254 ++],[
255 ++ AC_DEFINE(HAVE_POSIX_ACL_NAMESPACE, 1,
256 ++ [have posix acl supports user namespace])
257 ++ AC_MSG_RESULT([yes])
258 ++],[
259 ++ AC_MSG_RESULT([no])
260 ++])
261 ++])
262 ++
263 ++#
264 + # LC_PROG_LINUX
265 + #
266 + # Lustre linux kernel checks
267 +@@ -2390,6 +2412,9 @@ AC_DEFUN([LC_PROG_LINUX],
268 + LC_DENTRY_OPEN_USE_PATH
269 + LC_HAVE_IOP_ATOMIC_OPEN
270 +
271 ++ # 3.7
272 ++ LC_HAVE_POSIX_ACL_NAMESPACE
273 ++
274 + #
275 + if test x$enable_server = xyes ; then
276 + AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
277 +diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h
278 +index ac4414e..1ae9f7b 100644
279 +--- a/lustre/include/liblustre.h
280 ++++ b/lustre/include/liblustre.h
281 +@@ -452,8 +452,17 @@ static inline size_t posix_acl_xattr_size(int count)
282 + sizeof(posix_acl_xattr_entry);
283 + }
284 +
285 ++#ifdef HAVE_POSIX_ACL_NAMESPACE
286 ++struct user_namespace {};
287 ++struct user_namespace init_user_ns;
288 ++
289 ++static inline
290 ++struct posix_acl *posix_acl_from_xattr(struct user_namespace *user_ns,
291 ++ const void *value, size_t size)
292 ++#else
293 + static inline
294 +-struct posix_acl * posix_acl_from_xattr(const void *value, size_t size)
295 ++struct posix_acl *posix_acl_from_xattr(const void *value, size_t size)
296 ++#endif
297 + {
298 + return NULL;
299 + }
300 +diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c
301 +index 1d9923e..a311d65 100644
302 +--- a/lustre/llite/xattr.c
303 ++++ b/lustre/llite/xattr.c
304 +@@ -345,7 +345,11 @@ int ll_getxattr_common(struct inode *inode, const char *name,
305 + if (!acl)
306 + RETURN(-ENODATA);
307 +
308 +- rc = posix_acl_to_xattr(acl, buffer, size);
309 ++#ifdef HAVE_POSIX_ACL_NAMESPACE
310 ++ rc = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
311 ++#else
312 ++ rc = posix_acl_to_xattr(acl, buffer, size);
313 ++#endif
314 + posix_acl_release(acl);
315 + RETURN(rc);
316 + }
317 +diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c
318 +index 399c268..dcbab71 100644
319 +--- a/lustre/mdc/mdc_request.c
320 ++++ b/lustre/mdc/mdc_request.c
321 +@@ -448,7 +448,11 @@ static int mdc_unpack_acl(struct ptlrpc_request *req, struct lustre_md *md)
322 + if (!buf)
323 + RETURN(-EPROTO);
324 +
325 +- acl = posix_acl_from_xattr(buf, body->aclsize);
326 ++#ifdef HAVE_POSIX_ACL_NAMESPACE
327 ++ acl = posix_acl_from_xattr(&init_user_ns, buf, body->aclsize);
328 ++#else
329 ++ acl = posix_acl_from_xattr(buf, body->aclsize);
330 ++#endif
331 + if (IS_ERR(acl)) {
332 + rc = PTR_ERR(acl);
333 + CERROR("convert xattr to acl: %d\n", rc);
334 +--
335 +1.8.1.5
336 +
337
338 diff --git a/sys-cluster/lustre/files/0003-LU-2850-kernel-3.7-uneports-sock_map_fd.patch b/sys-cluster/lustre/files/0003-LU-2850-kernel-3.7-uneports-sock_map_fd.patch
339 new file mode 100644
340 index 0000000..eaae3cb
341 --- /dev/null
342 +++ b/sys-cluster/lustre/files/0003-LU-2850-kernel-3.7-uneports-sock_map_fd.patch
343 @@ -0,0 +1,121 @@
344 +From e095235edfe1339ccda0a61059ee4d3a2016e4f6 Mon Sep 17 00:00:00 2001
345 +From: Peng Tao <tao.peng@×××.com>
346 +Date: Tue, 26 Feb 2013 17:09:15 +0800
347 +Subject: [PATCH 3/5] LU-2850 kernel: 3.7 uneports sock_map_fd
348 +
349 +And exports sock_alloc_file. We should use sock_alloc_file instead.
350 +Besides, there is no need to mess with fd table.
351 +
352 +Signed-off-by: Peng Tao <tao.peng@×××.com>
353 +Change-Id: Iec3c8bc0d8fcb9d8f821dd9f0a82445e1e1096ff
354 +---
355 + libcfs/libcfs/linux/linux-tcpip.c | 39 ++++++++++++++++++++++++++++++++++++++-
356 + lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++
357 + 2 files changed, 58 insertions(+), 1 deletion(-)
358 +
359 +diff --git a/libcfs/libcfs/linux/linux-tcpip.c b/libcfs/libcfs/linux/linux-tcpip.c
360 +index cd07648..ce93aa8 100644
361 +--- a/libcfs/libcfs/linux/linux-tcpip.c
362 ++++ b/libcfs/libcfs/linux/linux-tcpip.c
363 +@@ -41,6 +41,40 @@
364 + #include <linux/if.h>
365 + #include <linux/in.h>
366 + #include <linux/file.h>
367 ++#ifdef HAVE_SOCK_ALLOC_FILE
368 ++int
369 ++libcfs_sock_ioctl(int cmd, unsigned long arg)
370 ++{
371 ++ mm_segment_t oldmm = get_fs();
372 ++ struct socket *sock;
373 ++ int rc;
374 ++ struct file *sock_filp;
375 ++
376 ++ rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
377 ++ if (rc != 0) {
378 ++ CERROR("Can't create socket: %d\n", rc);
379 ++ return rc;
380 ++ }
381 ++
382 ++ sock_filp = sock_alloc_file(sock, 0, NULL);
383 ++ if (IS_ERR(sock_filp)) {
384 ++ rc = PTR_ERR(sock_filp);
385 ++ sock_release(sock);
386 ++ goto out;
387 ++ }
388 ++ get_file(sock_filp);
389 ++
390 ++ set_fs(KERNEL_DS);
391 ++ if (sock_filp->f_op->unlocked_ioctl)
392 ++ rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg);
393 ++ set_fs(oldmm);
394 ++
395 ++ fput(sock_filp);
396 ++out:
397 ++ return rc;
398 ++}
399 ++#else /* !HAVE_SOCK_ALLOC_FILE */
400 ++
401 + /* For sys_open & sys_close */
402 + #include <linux/syscalls.h>
403 +
404 +@@ -61,8 +95,10 @@ libcfs_sock_ioctl(int cmd, unsigned long arg)
405 +
406 + #ifdef HAVE_SOCK_MAP_FD_2ARG
407 + fd = sock_map_fd(sock,0);
408 +-#else
409 ++#elif defined(HAVE_SOCK_MAP_FD)
410 + fd = sock_map_fd(sock);
411 ++#else
412 ++#error "Cannot find either sock_map_fd nor sock_alloc_file!"
413 + #endif
414 + if (fd < 0) {
415 + rc = fd;
416 +@@ -88,6 +124,7 @@ libcfs_sock_ioctl(int cmd, unsigned long arg)
417 + out:
418 + return rc;
419 + }
420 ++#endif /* !HAVE_SOCK_ALLOC_FILE */
421 +
422 + int
423 + libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
424 +diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
425 +index f424f87..3d62a4b 100644
426 +--- a/lustre/autoconf/lustre-core.m4
427 ++++ b/lustre/autoconf/lustre-core.m4
428 +@@ -2235,6 +2235,24 @@ LB_LINUX_TRY_COMPILE([
429 + ])
430 +
431 + #
432 ++# 3.7 unexports sock_map_fd() and exports sock_alloc_file
433 ++# see upstream commit 56b31d1
434 ++#
435 ++AC_DEFUN([LC_HAVE_SOCK_MAP_FD],
436 ++ [LB_CHECK_SYMBOL_EXPORT([sock_map_fd],
437 ++ [net/socket.c],
438 ++ [AC_DEFINE(HAVE_SOCK_MAP_FD, 1,
439 ++ [sock_map_fd is exported by the kernel])])
440 ++])
441 ++
442 ++AC_DEFUN([LC_HAVE_SOCK_ALLOC_FILE],
443 ++ [LB_CHECK_SYMBOL_EXPORT([sock_alloc_file],
444 ++ [net/socket.c],
445 ++ [AC_DEFINE(HAVE_SOCK_ALLOC_FILE, 1,
446 ++ [sock_alloc_file is exported by the kernel])])
447 ++])
448 ++
449 ++#
450 + # LC_PROG_LINUX
451 + #
452 + # Lustre linux kernel checks
453 +@@ -2414,6 +2432,8 @@ AC_DEFUN([LC_PROG_LINUX],
454 +
455 + # 3.7
456 + LC_HAVE_POSIX_ACL_NAMESPACE
457 ++ LC_HAVE_SOCK_MAP_FD
458 ++ LC_HAVE_SOCK_ALLOC_FILE
459 +
460 + #
461 + if test x$enable_server = xyes ; then
462 +--
463 +1.8.1.5
464 +
465
466 diff --git a/sys-cluster/lustre/files/0004-LU-2850-kernel-3.7-get-putname-uses-struct-filename.patch b/sys-cluster/lustre/files/0004-LU-2850-kernel-3.7-get-putname-uses-struct-filename.patch
467 new file mode 100644
468 index 0000000..bfc1439
469 --- /dev/null
470 +++ b/sys-cluster/lustre/files/0004-LU-2850-kernel-3.7-get-putname-uses-struct-filename.patch
471 @@ -0,0 +1,226 @@
472 +From 5d050ddbf8ebe5104e0320b9e1028411e495a1fe Mon Sep 17 00:00:00 2001
473 +From: Peng Tao <tao.peng@×××.com>
474 +Date: Wed, 27 Feb 2013 17:51:46 +0800
475 +Subject: [PATCH 4/5] LU-2850 kernel: 3.7 get/putname uses struct filename
476 +
477 +3.7 vfs introduces struct filename and changes getname/putname
478 +parameter to use it.
479 +
480 +Signed-off-by: Peng Tao <tao.peng@×××.com>
481 +Change-Id: Ifc3cfa54220b83b8de5aebfa5464c6efa5525599
482 +---
483 + lustre/autoconf/lustre-core.m4 | 26 ++++++++++++++++++
484 + lustre/include/linux/lustre_compat25.h | 37 +++++++++++++++++++++++++
485 + lustre/llite/dir.c | 50 +++++++++++++++++-----------------
486 + lustre/llite/llite_internal.h | 2 +-
487 + lustre/llite/namei.c | 2 +-
488 + 5 files changed, 90 insertions(+), 27 deletions(-)
489 +
490 +diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
491 +index 3d62a4b..0c177b1 100644
492 +--- a/lustre/autoconf/lustre-core.m4
493 ++++ b/lustre/autoconf/lustre-core.m4
494 +@@ -2253,6 +2253,31 @@ AC_DEFUN([LC_HAVE_SOCK_ALLOC_FILE],
495 + ])
496 +
497 + #
498 ++# 3.7 vfs introduces struct filename and changes getname/putname
499 ++# parameter to use it
500 ++# see kernel commit adb5c247 and 91a27b2a
501 ++#
502 ++AC_DEFUN([LC_HAVE_STRUCT_FILENAME],
503 ++[AC_MSG_CHECKING([if vfs has struct filename])
504 ++tmp_flags="$EXTRA_KCFLAGS"
505 ++EXTRA_KCFLAGS="-Werror"
506 ++LB_LINUX_TRY_COMPILE([
507 ++ #include <linux/fs.h>
508 ++],[
509 ++ struct filename *filename;
510 ++ filename = getname(NULL);
511 ++ putname(filename);
512 ++],[
513 ++ AC_DEFINE(HAVE_STRUCT_FILENAME, 1,
514 ++ [vfs has struct filename])
515 ++ AC_MSG_RESULT([yes])
516 ++],[
517 ++ AC_MSG_RESULT([no])
518 ++])
519 ++EXTRA_KCFLAGS="$tmp_flags"
520 ++])
521 ++
522 ++#
523 + # LC_PROG_LINUX
524 + #
525 + # Lustre linux kernel checks
526 +@@ -2434,6 +2459,7 @@ AC_DEFUN([LC_PROG_LINUX],
527 + LC_HAVE_POSIX_ACL_NAMESPACE
528 + LC_HAVE_SOCK_MAP_FD
529 + LC_HAVE_SOCK_ALLOC_FILE
530 ++ LC_HAVE_STRUCT_FILENAME
531 +
532 + #
533 + if test x$enable_server = xyes ; then
534 +diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h
535 +index e300597..d62646e 100644
536 +--- a/lustre/include/linux/lustre_compat25.h
537 ++++ b/lustre/include/linux/lustre_compat25.h
538 +@@ -750,4 +750,41 @@ static inline struct dentry *d_make_root(struct inode *root)
539 + }
540 + #endif
541 +
542 ++#ifndef HAVE_STRUCT_FILENAME
543 ++struct filename {
544 ++ char *name;
545 ++};
546 ++static inline struct filename *ll_getname(const char __user *name)
547 ++{
548 ++ struct filename *filename;
549 ++
550 ++ filename = kmalloc(sizeof(struct filename), GFP_KERNEL);
551 ++ if (filename == NULL)
552 ++ return ERR_PTR(-ENOMEM);
553 ++
554 ++ filename->name = getname(name);
555 ++ if (unlikely(IS_ERR(filename->name))) {
556 ++ int err = PTR_ERR(filename->name);
557 ++ kfree(filename);
558 ++ return ERR_PTR(err);
559 ++ } else {
560 ++ return filename;
561 ++ }
562 ++}
563 ++static inline void ll_putname(struct filename *filename)
564 ++{
565 ++ putname(filename->name);
566 ++ kfree(filename);
567 ++}
568 ++#else
569 ++static inline struct filename *ll_getname(const char __user *name)
570 ++{
571 ++ return getname(name);
572 ++}
573 ++static inline void ll_putname(struct filename *filename)
574 ++{
575 ++ putname(filename);
576 ++}
577 ++#endif /* !HAVE_STRUCT_FILENAME */
578 ++
579 + #endif /* _COMPAT25_H */
580 +diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
581 +index 466d259..49b159a 100644
582 +--- a/lustre/llite/dir.c
583 ++++ b/lustre/llite/dir.c
584 +@@ -1406,7 +1406,7 @@ free_lmv:
585 + RETURN(rc);
586 + }
587 + case LL_IOC_REMOVE_ENTRY: {
588 +- char *filename = NULL;
589 ++ struct filename *filename = NULL;
590 + int namelen = 0;
591 + int rc;
592 +
593 +@@ -1418,18 +1418,18 @@ free_lmv:
594 + if (!(exp_connect_flags(sbi->ll_md_exp) & OBD_CONNECT_LVB_TYPE))
595 + return -ENOTSUPP;
596 +
597 +- filename = getname((const char *)arg);
598 ++ filename = ll_getname((const char *)arg);
599 + if (IS_ERR(filename))
600 + RETURN(PTR_ERR(filename));
601 +
602 +- namelen = strlen(filename);
603 ++ namelen = strlen(filename->name);
604 + if (namelen < 1)
605 + GOTO(out_rmdir, rc = -EINVAL);
606 +
607 +- rc = ll_rmdir_entry(inode, filename, namelen);
608 ++ rc = ll_rmdir_entry(inode, filename->name, namelen);
609 + out_rmdir:
610 +- if (filename)
611 +- putname(filename);
612 ++ if (filename)
613 ++ ll_putname(filename);
614 + RETURN(rc);
615 + }
616 + case LL_IOC_LOV_SWAP_LAYOUTS:
617 +@@ -1440,21 +1440,21 @@ out_rmdir:
618 + case LL_IOC_MDC_GETINFO:
619 + case IOC_MDC_GETFILEINFO:
620 + case IOC_MDC_GETFILESTRIPE: {
621 +- struct ptlrpc_request *request = NULL;
622 +- struct lov_user_md *lump;
623 +- struct lov_mds_md *lmm = NULL;
624 +- struct mdt_body *body;
625 +- char *filename = NULL;
626 +- int lmmsize;
627 +-
628 +- if (cmd == IOC_MDC_GETFILEINFO ||
629 +- cmd == IOC_MDC_GETFILESTRIPE) {
630 +- filename = getname((const char *)arg);
631 +- if (IS_ERR(filename))
632 +- RETURN(PTR_ERR(filename));
633 +-
634 +- rc = ll_lov_getstripe_ea_info(inode, filename, &lmm,
635 +- &lmmsize, &request);
636 ++ struct ptlrpc_request *request = NULL;
637 ++ struct lov_user_md *lump;
638 ++ struct lov_mds_md *lmm = NULL;
639 ++ struct mdt_body *body;
640 ++ struct filename *filename = NULL;
641 ++ int lmmsize;
642 ++
643 ++ if (cmd == IOC_MDC_GETFILEINFO ||
644 ++ cmd == IOC_MDC_GETFILESTRIPE) {
645 ++ filename = ll_getname((const char *)arg);
646 ++ if (IS_ERR(filename))
647 ++ RETURN(PTR_ERR(filename));
648 ++
649 ++ rc = ll_lov_getstripe_ea_info(inode, filename->name,
650 ++ &lmm, &lmmsize, &request);
651 + } else {
652 + rc = ll_dir_getstripe(inode, &lmm, &lmmsize, &request);
653 + }
654 +@@ -1514,10 +1514,10 @@ out_rmdir:
655 +
656 + EXIT;
657 + out_req:
658 +- ptlrpc_req_finished(request);
659 +- if (filename)
660 +- putname(filename);
661 +- return rc;
662 ++ ptlrpc_req_finished(request);
663 ++ if (filename)
664 ++ ll_putname(filename);
665 ++ return rc;
666 + }
667 + case IOC_LOV_GETINFO: {
668 + struct lov_user_mds_data *lumd;
669 +diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
670 +index 9329d6c..a577f36 100644
671 +--- a/lustre/llite/llite_internal.h
672 ++++ b/lustre/llite/llite_internal.h
673 +@@ -705,7 +705,7 @@ struct lookup_intent *ll_convert_intent(struct open_intent *oit,
674 + int lookup_flags);
675 + #endif
676 + struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de);
677 +-int ll_rmdir_entry(struct inode *dir, char *name, int namelen);
678 ++int ll_rmdir_entry(struct inode *dir, const char *name, int namelen);
679 +
680 + /* llite/rw.c */
681 + int ll_prepare_write(struct file *, struct page *, unsigned from, unsigned to);
682 +diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c
683 +index 3bcf3ff..6c99a7c 100644
684 +--- a/lustre/llite/namei.c
685 ++++ b/lustre/llite/namei.c
686 +@@ -1142,7 +1142,7 @@ static int ll_rmdir_generic(struct inode *dir, struct dentry *dparent,
687 + /**
688 + * Remove dir entry
689 + **/
690 +-int ll_rmdir_entry(struct inode *dir, char *name, int namelen)
691 ++int ll_rmdir_entry(struct inode *dir, const char *name, int namelen)
692 + {
693 + struct ptlrpc_request *request = NULL;
694 + struct md_op_data *op_data;
695 +--
696 +1.8.1.5
697 +
698
699 diff --git a/sys-cluster/lustre/files/0005-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch b/sys-cluster/lustre/files/0005-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch
700 new file mode 100644
701 index 0000000..c19bb70
702 --- /dev/null
703 +++ b/sys-cluster/lustre/files/0005-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch
704 @@ -0,0 +1,82 @@
705 +From 89da0781847c0eb2efd0556519560a41f352b57f Mon Sep 17 00:00:00 2001
706 +From: Peng Tao <tao.peng@×××.com>
707 +Date: Tue, 26 Feb 2013 18:09:42 +0800
708 +Subject: [PATCH 5/5] LU-2850 kernel: 3.8 upstream removes vmtruncate()
709 +
710 +vmtruncate() is removed since upstream commit b9f61c3.
711 +We can open code is for llite though.
712 +
713 +Signed-off-by: Peng Tao <tao.peng@×××.com>
714 +Change-Id: I9d4f43a5c181f16482b4caa021ba7a09ee52b600
715 +---
716 + lustre/autoconf/lustre-core.m4 | 23 +++++++++++++++++++++++
717 + lustre/llite/vvp_io.c | 10 +++++++++-
718 + 2 files changed, 32 insertions(+), 1 deletion(-)
719 +
720 +diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
721 +index 0c177b1..290ac89 100644
722 +--- a/lustre/autoconf/lustre-core.m4
723 ++++ b/lustre/autoconf/lustre-core.m4
724 +@@ -2278,6 +2278,26 @@ EXTRA_KCFLAGS="$tmp_flags"
725 + ])
726 +
727 + #
728 ++# 3.8 removes vmtruncate()
729 ++# see upstream commit b9f61c3
730 ++#
731 ++AC_DEFUN([LC_HAVE_MM_VMTRUNCATE],
732 ++[AC_MSG_CHECKING([if mm has vmtruncate])
733 ++LB_LINUX_TRY_COMPILE([
734 ++ #include <linux/mm.h>
735 ++],[
736 ++ vmtruncate(NULL, 0);
737 ++],[
738 ++ AC_DEFINE(HAVE_MM_VMTRUNCATE, 1,
739 ++ [vmtruncate is defined by the kernel])
740 ++ AC_MSG_RESULT([yes])
741 ++],[
742 ++ AC_MSG_RESULT([no])
743 ++])
744 ++])
745 ++
746 ++
747 ++#
748 + # LC_PROG_LINUX
749 + #
750 + # Lustre linux kernel checks
751 +@@ -2461,6 +2481,9 @@ AC_DEFUN([LC_PROG_LINUX],
752 + LC_HAVE_SOCK_ALLOC_FILE
753 + LC_HAVE_STRUCT_FILENAME
754 +
755 ++ # 3.8
756 ++ LC_HAVE_MM_VMTRUNCATE
757 ++
758 + #
759 + if test x$enable_server = xyes ; then
760 + AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
761 +diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c
762 +index 9020d77..25f631c 100644
763 +--- a/lustre/llite/vvp_io.c
764 ++++ b/lustre/llite/vvp_io.c
765 +@@ -362,9 +362,17 @@ static int vvp_do_vmtruncate(struct inode *inode, size_t size)
766 + * Only ll_inode_size_lock is taken at this level.
767 + */
768 + ll_inode_size_lock(inode);
769 ++#ifdef HAVE_MM_VMTRUNCATE
770 + result = vmtruncate(inode, size);
771 ++#else
772 ++ result = inode_newsize_ok(inode, size);
773 ++ if (result < 0) {
774 ++ ll_inode_size_unlock(inode);
775 ++ return result;
776 ++ }
777 ++ truncate_setsize(inode, size);
778 ++#endif
779 + ll_inode_size_unlock(inode);
780 +-
781 + return result;
782 + }
783 +
784 +--
785 +1.8.1.5
786 +
787
788 diff --git a/sys-cluster/lustre/lustre-9999.ebuild b/sys-cluster/lustre/lustre-9999.ebuild
789 index 6d1ef5c..99ed754 100644
790 --- a/sys-cluster/lustre/lustre-9999.ebuild
791 +++ b/sys-cluster/lustre/lustre-9999.ebuild
792 @@ -24,6 +24,14 @@ RDEPEND="${DEPEND}"
793
794 BUILD_PARAMS="-C ${KV_DIR} SUBDIRS=${S}"
795
796 +PATHCES=(
797 + "${FILESDIR}/0001-LU-2850-build-check-header-files-in-generated-uapi-d.patch"
798 + "${FILESDIR}/0002-LU-2850-kernel-3.7-kernel-posix-acl-needs-userns.patch"
799 + "${FILESDIR}/0003-LU-2850-kernel-3.7-uneports-sock_map_fd.patch"
800 + "${FILESDIR}/0004-LU-2850-kernel-3.7-get-putname-uses-struct-filename.patch"
801 + "${FILESDIR}/0005-LU-2850-kernel-3.8-upstream-removes-vmtruncate.patch"
802 +)
803 +
804 pkg_setup() {
805 linux-mod_pkg_setup
806 linux-info_pkg_setup