]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Add upstream patches for linux-4.2 support
authorBenjamin Kaduk <kaduk@mit.edu>
Mon, 17 Aug 2015 18:59:57 +0000 (14:59 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Mon, 17 Aug 2015 19:00:43 +0000 (15:00 -0400)
debian/changelog
debian/patches/0004-Linux-CM-Use-kernel-allocator-directly.patch [new file with mode: 0644]
debian/patches/0005-Linux-4.2-Pass-namespace-to-sock_create_kern.patch [new file with mode: 0644]
debian/patches/0006-Linux-4.2-total_link_count-is-no-longer-accessible.patch [new file with mode: 0644]
debian/patches/0007-Linux-Add-AC_CHECK_LINUX_OPERATION-configure-macro.patch [new file with mode: 0644]
debian/patches/0008-Linux-4.2-Changes-in-link-operation-APIs.patch [new file with mode: 0644]
debian/patches/series

index b2acb0508fae03bb1fabbc371a6912290a7a5d71..e8bd6da1a69457b98eaf8f14b5c728fdba741958 100644 (file)
@@ -8,6 +8,7 @@ openafs (1.6.14-1) UNRELEASED; urgency=medium
   * Note that the protocol document rfc5864.txt is dual licensed.
     (Closes: #768385)
   * Supply copyright notice for systemd helper scripts. (Closes: #779170)
+  * Import upstream patches to support the 4.2 Linux kernel.
 
  -- Benjamin Kaduk <kaduk@mit.edu>  Mon, 17 Aug 2015 11:19:55 -0400
 
diff --git a/debian/patches/0004-Linux-CM-Use-kernel-allocator-directly.patch b/debian/patches/0004-Linux-CM-Use-kernel-allocator-directly.patch
new file mode 100644 (file)
index 0000000..9a30424
--- /dev/null
@@ -0,0 +1,91 @@
+From: Simon Wilkinson <sxw@your-file-system.com>
+Date: Sun, 17 Apr 2011 23:43:51 +0100
+Subject: Linux CM: Use kernel allocator directly
+
+In another few locations within the Linux portion of the cache
+manager, directly use the kernel allocator. We can do so here
+because we can guarantee that the amount of memory being allocated
+is less than the page size, and there is a kfree() in all of the
+exit paths, so we don't need the magic freeing behaviour, either.
+
+Change-Id: I9c9f3a0b8243b66cb081cd2b35f0d27aaa378934
+Reviewed-on: http://gerrit.openafs.org/4752
+Reviewed-by: Derrick Brashear <shadow@dementia.org>
+Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
+Tested-by: Derrick Brashear <shadow@dementia.org>
+(cherry picked from commit 7a70c2907b0435653098a611a140fea1ac0b2fac)
+---
+ src/afs/LINUX/osi_vfsops.c   |  4 ++--
+ src/afs/LINUX/osi_vnodeops.c | 16 ++++++++--------
+ 2 files changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c
+index d6504ae..934478d 100644
+--- a/src/afs/LINUX/osi_vfsops.c
++++ b/src/afs/LINUX/osi_vfsops.c
+@@ -112,7 +112,7 @@ afs_fill_super(struct super_block *sb, void *data, int silent)
+ #endif
+     /* used for inodes backing_dev_info field, also */
+-    afs_backing_dev_info = osi_Alloc(sizeof(struct backing_dev_info));
++    afs_backing_dev_info = kmalloc(sizeof(struct backing_dev_info), GFP_NOFS);
+     memset(afs_backing_dev_info, 0, sizeof(struct backing_dev_info));
+ #if defined(HAVE_LINUX_BDI_INIT)
+     bdi_init(afs_backing_dev_info);
+@@ -338,7 +338,7 @@ afs_put_super(struct super_block *sbp)
+ #if defined(HAVE_LINUX_BDI_INIT)
+     bdi_destroy(afs_backing_dev_info);
+ #endif
+-    osi_Free(afs_backing_dev_info, sizeof(struct backing_dev_info));
++    kfree(afs_backing_dev_info);
+     AFS_GUNLOCK();
+     sbp->s_dev = 0;
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index 91c09ed..a8f0074 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -1893,7 +1893,7 @@ static int afs_linux_follow_link(struct dentry *dentry, struct nameidata *nd)
+     int code;
+     char *name;
+-    name = osi_Alloc(PATH_MAX);
++    name = kmalloc(PATH_MAX, GFP_NOFS);
+     if (!name) {
+       return -EIO;
+     }
+@@ -1915,9 +1915,9 @@ static void
+ afs_linux_put_link(struct dentry *dentry, struct nameidata *nd)
+ {
+     char *name = nd_get_link(nd);
+-    if (name && !IS_ERR(name)) {
+-      osi_Free(name, PATH_MAX);
+-    }
++
++    if (name && !IS_ERR(name))
++      kfree(name);
+ }
+ #endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */
+@@ -2174,8 +2174,8 @@ afs_linux_fillpage(struct file *fp, struct page *pp)
+     address = kmap(pp);
+     ClearPageError(pp);
+-    auio = osi_Alloc(sizeof(struct uio));
+-    iovecp = osi_Alloc(sizeof(struct iovec));
++    auio = kmalloc(sizeof(struct uio), GFP_NOFS);
++    iovecp = kmalloc(sizeof(struct iovec), GFP_NOFS);
+     setup_uio(auio, iovecp, (char *)address, offset, PAGE_SIZE, UIO_READ,
+               AFS_UIOSYS);
+@@ -2206,8 +2206,8 @@ afs_linux_fillpage(struct file *fp, struct page *pp)
+     kunmap(pp);
+-    osi_Free(auio, sizeof(struct uio));
+-    osi_Free(iovecp, sizeof(struct iovec));
++    kfree(auio);
++    kfree(iovecp);
+     crfree(credp);
+     return afs_convert_code(code);
diff --git a/debian/patches/0005-Linux-4.2-Pass-namespace-to-sock_create_kern.patch b/debian/patches/0005-Linux-4.2-Pass-namespace-to-sock_create_kern.patch
new file mode 100644 (file)
index 0000000..90c01a7
--- /dev/null
@@ -0,0 +1,51 @@
+From: Marc Dionne <marc.dionne@your-file-system.com>
+Date: Wed, 8 Jul 2015 14:32:31 -0300
+Subject: Linux 4.2: Pass namespace to sock_create_kern
+
+sock_create_kern gains an additional network namespace
+argument.
+
+Pass in the default system namesapce.
+
+Change-Id: I640e9497510242788e5060759779785ffb563a81
+Reviewed-on: http://gerrit.openafs.org/11925
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
+Reviewed-by: Chas Williams <3chas3@gmail.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
+(cherry picked from commit e597b879677d023165298adadfb88db031883ff4)
+---
+ acinclude.m4           | 3 +++
+ src/rx/LINUX/rx_knet.c | 4 +++-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 79df95a..0d1bb61 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -989,6 +989,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
+                AC_CHECK_LINUX_FUNC([sock_create_kern],
+                                    [#include <linux/net.h>],
+                                    [sock_create_kern(0, 0, 0, NULL);])
++               AC_CHECK_LINUX_FUNC([sock_create_kern_ns],
++                                   [#include <linux/net.h>],
++                                   [sock_create_kern(NULL, 0, 0, 0, NULL);])
+                AC_CHECK_LINUX_FUNC([splice_direct_to_actor],
+                                    [#include <linux/splice.h>],
+                                    [splice_direct_to_actor(NULL,NULL,NULL);])
+diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c
+index 3f7f2bc..1a5cfde 100644
+--- a/src/rx/LINUX/rx_knet.c
++++ b/src/rx/LINUX/rx_knet.c
+@@ -42,7 +42,9 @@ rxk_NewSocketHost(afs_uint32 ahost, short aport)
+     int pmtu = IP_PMTUDISC_DONT;
+ #endif
+-#ifdef HAVE_LINUX_SOCK_CREATE_KERN
++#ifdef HAVE_LINUX_SOCK_CREATE_KERN_NS
++    code = sock_create_kern(&init_net, AF_INET, SOCK_DGRAM, IPPROTO_UDP, &sockp);
++#elif defined(HAVE_LINUX_SOCK_CREATE_KERN)
+     code = sock_create_kern(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &sockp);
+ #elif defined(LINUX_KERNEL_SOCK_CREATE_V)
+     code = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &sockp, 0);
diff --git a/debian/patches/0006-Linux-4.2-total_link_count-is-no-longer-accessible.patch b/debian/patches/0006-Linux-4.2-total_link_count-is-no-longer-accessible.patch
new file mode 100644 (file)
index 0000000..afc8ace
--- /dev/null
@@ -0,0 +1,59 @@
+From: Marc Dionne <marc.dionne@your-file-system.com>
+Date: Mon, 6 Jul 2015 11:00:13 -0300
+Subject: Linux 4.2: total_link_count is no longer accessible
+
+The value is now stored in the nameidata structure which
+is private to fs/namei.c, so we can't modify it here.
+
+The effect is that using a path that contains 40+ directories
+may fail with ELOOP, depending on which directories in the
+path were previously used.  After a directory is accessed once
+its D_AUTOMOUNT flag is reset and it will no longer count
+against the symlink limit in later path lookups.
+
+Change-Id: I90e4cb0e9004b075bff2330d165c67b7a923193f
+Reviewed-on: http://gerrit.openafs.org/11926
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
+(cherry picked from commit 89aeb71a3e23c944f58cfa9572e9eae4d2130d37)
+---
+ acinclude.m4                 |  1 +
+ src/afs/LINUX/osi_vnodeops.c | 12 ++++++++++--
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 0d1bb61..935fd00 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -894,6 +894,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
+                AC_CHECK_LINUX_STRUCT([task_struct], [sigmask_lock], [sched.h])
+                AC_CHECK_LINUX_STRUCT([task_struct], [tgid], [sched.h])
+                AC_CHECK_LINUX_STRUCT([task_struct], [thread_info], [sched.h])
++               AC_CHECK_LINUX_STRUCT([task_struct], [total_link_count], [sched.h])
+                LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM
+                dnl Check for typed structure elements
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index a8f0074..a878eb4 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -1385,9 +1385,17 @@ afs_dentry_automount(afs_linux_path_t *path)
+ {
+     struct dentry *target;
+-    /* avoid symlink resolution limits when resolving; we cannot contribute to
+-     * an infinite symlink loop */
++    /* 
++     * Avoid symlink resolution limits when resolving; we cannot contribute to
++     * an infinite symlink loop.
++     *
++     * On newer kernels the field has moved to the private nameidata structure
++     * so we can't adjust it here.  This may cause ELOOP when using a path with
++     * 40 or more directories that are not already in the dentry cache.
++     */
++#if defined(STRUCT_TASK_STRUCT_HAS_TOTAL_LINK_COUNT)
+     current->total_link_count--;
++#endif
+     target = canonical_dentry(path->dentry->d_inode);
diff --git a/debian/patches/0007-Linux-Add-AC_CHECK_LINUX_OPERATION-configure-macro.patch b/debian/patches/0007-Linux-Add-AC_CHECK_LINUX_OPERATION-configure-macro.patch
new file mode 100644 (file)
index 0000000..19b36a8
--- /dev/null
@@ -0,0 +1,46 @@
+From: Marc Dionne <marc.dionne@your-file-system.com>
+Date: Mon, 6 Jul 2015 12:00:10 -0300
+Subject: Linux: Add AC_CHECK_LINUX_OPERATION configure macro
+
+Add a new macro to check the signature of a particular
+operation against a provided typed argument list.
+One of the arguments is an arbitrary label that is used
+to construct the pre-processor define name.  This will
+allow for testing of different forms for the same
+operation.
+
+This can be used to replace many of the remaining odd
+checks in src/cf/linux_test4.m4.
+
+Change-Id: Ic619ace54f81aa8e1eb744e2d11f541a303b9587
+Reviewed-on: http://gerrit.openafs.org/11927
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
+(cherry picked from commit c2c0b6bc86c6d67814d0f7fe14fa8eefc445b4a4)
+---
+ src/cf/linux-test1.m4 | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4
+index f7176d2..fd5bfd8 100644
+--- a/src/cf/linux-test1.m4
++++ b/src/cf/linux-test1.m4
+@@ -150,3 +150,18 @@ AC_DEFUN([AC_CHECK_LINUX_TYPED_STRUCT],
+                      [Define if kernel typedef'd $1 has the $2 element])
+  ])
++dnl AC_CHECK_LINUX_OPERATION([structure], [operation], [label], [includes], [return_type], [args])
++AC_DEFUN([AC_CHECK_LINUX_OPERATION],
++ [AS_VAR_PUSHDEF([ac_linux_operation], [ac_cv_linux_operation_$1_$2_$3])
++  AC_CACHE_CHECK([operation $2 in $1], [ac_linux_operation],
++    [save_CPPFLAGS="$CPPFLAGS"
++     CPPFLAGS="$CPPFLAGS -Werror"
++     AC_TRY_KBUILD([$4], [struct $1 ops; $5 op($6) { return ($5)0; }; ops.$2 = op;],
++                 AS_VAR_SET([ac_linux_operation], [yes]),
++                 AS_VAR_SET([ac_linux_operation], [no]))
++     CPPFLAGS="$save_CPPFLAGS"
++    ])
++  AS_IF([test AS_VAR_GET([ac_linux_operation]) = yes],
++      [AC_DEFINE(AS_TR_CPP(HAVE_LINUX_$1_$2_$3), 1,
++                 [Define if $1 has $2 operation of form $6])])
++ ])
diff --git a/debian/patches/0008-Linux-4.2-Changes-in-link-operation-APIs.patch b/debian/patches/0008-Linux-4.2-Changes-in-link-operation-APIs.patch
new file mode 100644 (file)
index 0000000..902bcec
--- /dev/null
@@ -0,0 +1,106 @@
+From: Marc Dionne <marc.dionne@your-file-system.com>
+Date: Mon, 6 Jul 2015 13:01:38 -0300
+Subject: Linux 4.2: Changes in link operation APIs
+
+The follow_link and put_link operations are revised.
+Test for the new signature and adapt the code.
+
+Change-Id: I2834589cbe36c41924ab0505e6ca4ecd797a57fd
+Reviewed-on: http://gerrit.openafs.org/11928
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
+(cherry picked from commit 6c3ac6dc1ea865153a65b5c5c4f288617a3e6d0f)
+---
+ acinclude.m4                 | 10 ++++++++++
+ src/afs/LINUX/osi_vnodeops.c | 27 +++++++++++++++++++++++++++
+ 2 files changed, 37 insertions(+)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 935fd00..af56ea4 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -837,6 +837,16 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
+                LINUX_KBUILD_USES_EXTRA_CFLAGS
+                LINUX_KERNEL_COMPILE_WORKS
++               dnl Operation signature checks
++               AC_CHECK_LINUX_OPERATION([inode_operations], [follow_link], [no_nameidata],
++                                        [#include <linux/fs.h>],
++                                        [const char *],
++                                        [struct dentry *dentry, void **link_data])
++               AC_CHECK_LINUX_OPERATION([inode_operations], [put_link], [no_nameidata],
++                                        [#include <linux/fs.h>],
++                                        [void],
++                                        [struct inode *inode, void *link_data])
++
+                dnl Check for header files
+                AC_CHECK_LINUX_HEADER([config.h])
+                AC_CHECK_LINUX_HEADER([completion.h])
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index a878eb4..3c0cb33 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -1896,14 +1896,22 @@ afs_linux_readlink(struct dentry *dp, char *target, int maxlen)
+ /* afs_linux_follow_link
+  * a file system dependent link following routine.
+  */
++#if defined(HAVE_LINUX_INODE_OPERATIONS_FOLLOW_LINK_NO_NAMEIDATA)
++static const char *afs_linux_follow_link(struct dentry *dentry, void **link_data)
++#else
+ static int afs_linux_follow_link(struct dentry *dentry, struct nameidata *nd)
++#endif
+ {
+     int code;
+     char *name;
+     name = kmalloc(PATH_MAX, GFP_NOFS);
+     if (!name) {
++#if defined(HAVE_LINUX_INODE_OPERATIONS_FOLLOW_LINK_NO_NAMEIDATA)
++      return ERR_PTR(-EIO);
++#else
+       return -EIO;
++#endif
+     }
+     AFS_GLOCK();
+@@ -1911,14 +1919,32 @@ static int afs_linux_follow_link(struct dentry *dentry, struct nameidata *nd)
+     AFS_GUNLOCK();
+     if (code < 0) {
++#if defined(HAVE_LINUX_INODE_OPERATIONS_FOLLOW_LINK_NO_NAMEIDATA)
++      return ERR_PTR(code);
++#else
+       return code;
++#endif
+     }
+     name[code] = '\0';
++#if defined(HAVE_LINUX_INODE_OPERATIONS_FOLLOW_LINK_NO_NAMEIDATA)
++    return *link_data = name;
++#else
+     nd_set_link(nd, name);
+     return 0;
++#endif
+ }
++#if defined(HAVE_LINUX_INODE_OPERATIONS_PUT_LINK_NO_NAMEIDATA)
++static void
++afs_linux_put_link(struct inode *inode, void *link_data)
++{
++    char *name = link_data;
++
++    if (name && !IS_ERR(name))
++      kfree(name);
++}
++#else
+ static void
+ afs_linux_put_link(struct dentry *dentry, struct nameidata *nd)
+ {
+@@ -1927,6 +1953,7 @@ afs_linux_put_link(struct dentry *dentry, struct nameidata *nd)
+     if (name && !IS_ERR(name))
+       kfree(name);
+ }
++#endif /* HAVE_LINUX_INODE_OPERATIONS_PUT_LINK_NO_NAMEIDATA */
+ #endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */
index a55c8fbc1d5d972605a15ba15ad1a971a40612c3..a6c972ce1ee46b8103403ecd8f87734c9df94495 100644 (file)
@@ -1,3 +1,8 @@
 0001-userok.c-Fix-fixed-size-on-stack-path-buffers.patch
 0002-Tweak-AFSDIR_PATH_MAX-definition.patch
 0003-Add-dummy-exit-command-for-afsd-to-do-nothing.patch
+0004-Linux-CM-Use-kernel-allocator-directly.patch
+0005-Linux-4.2-Pass-namespace-to-sock_create_kern.patch
+0006-Linux-4.2-total_link_count-is-no-longer-accessible.patch
+0007-Linux-Add-AC_CHECK_LINUX_OPERATION-configure-macro.patch
+0008-Linux-4.2-Changes-in-link-operation-APIs.patch