From: Benjamin Kaduk Date: Mon, 16 May 2016 02:18:56 +0000 (-0400) Subject: Pull in patches from gerrit for Linux 4.5 support X-Git-Tag: debian/1.6.18-1~2 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=73df16b456bb6bb21194def7c6d24b5365d198b6;p=packages%2Fo%2Fopenafs.git Pull in patches from gerrit for Linux 4.5 support --- diff --git a/debian/changelog b/debian/changelog index 057a407e8..ac2590622 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,8 @@ openafs (1.6.18-1) UNRELEASED; urgency=high - Prefer -dryrun arguments to -noexecute. - Limit ChangeAddr RPCs to removal, to avoid database corruption. - Improve behavior relating to large (~2GB fetches from the fileserver). + * Import patches from upstream gerrit to improve support for + Linux 4.5 kernels. (Closes: #821782) -- Benjamin Kaduk Sun, 15 May 2016 16:03:14 -0400 diff --git a/debian/patches/0002-Linux-4.5-no-highmem-in-symlink-ops.patch b/debian/patches/0002-Linux-4.5-no-highmem-in-symlink-ops.patch new file mode 100644 index 000000000..e89e1a3fd --- /dev/null +++ b/debian/patches/0002-Linux-4.5-no-highmem-in-symlink-ops.patch @@ -0,0 +1,42 @@ +From: Benjamin Kaduk +Date: Sun, 1 May 2016 19:04:45 -0400 +Subject: Linux 4.5: no highmem in symlink ops + +Symlink bodies in the pagecache should not be in highmem, as +upstream converted in commit 21fc61c73. + +Change-Id: I1e4c3c51308df096cdfa4d5e7b16279e275e7f41 +(cherry picked from commit 04cd1afdf4670dbda848ef945f595d2a176e7fa9) +--- + acinclude.m4 | 3 +++ + src/afs/LINUX/osi_vnodeops.c | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/acinclude.m4 b/acinclude.m4 +index 4f8e2c0..c8a7ceb 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -1034,6 +1034,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) + [#include + #include ], + [kthread_run(NULL, NULL, "test");]) ++ AC_CHECK_LINUX_FUNC([inode_nohighmem], ++ [#include ], ++ [inode_nohighmem(NULL);]) + + dnl Consequences - things which get set as a result of the + dnl above tests +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index 1b99c94..2f753dd 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -3143,6 +3143,9 @@ afs_fill_inode(struct inode *ip, struct vattr *vattr) + + } else if (S_ISLNK(ip->i_mode)) { + ip->i_op = &afs_symlink_iops; ++#if defined(HAVE_LINUX_INODE_NOHIGHMEM) ++ inode_nohighmem(ip); ++#endif + #if defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE) + ip->i_data.a_ops = &afs_symlink_aops; + ip->i_mapping = &ip->i_data; diff --git a/debian/patches/0003-Add-dummy-exit-command-for-afsd-to-do-nothing.patch b/debian/patches/0003-Add-dummy-exit-command-for-afsd-to-do-nothing.patch index 5f1534e50..7174108c6 100644 --- a/debian/patches/0003-Add-dummy-exit-command-for-afsd-to-do-nothing.patch +++ b/debian/patches/0003-Add-dummy-exit-command-for-afsd-to-do-nothing.patch @@ -7,10 +7,10 @@ Subject: Add dummy -exit command for afsd to do nothing 1 file changed, 5 insertions(+) diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c -index 141dc69..ab8e560 100644 +index 0d5f413..d5d014f 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c -@@ -1909,6 +1909,10 @@ mainproc(struct cmd_syndesc *as, void *arock) +@@ -1911,6 +1911,10 @@ mainproc(struct cmd_syndesc *as, void *arock) /* -rxmaxfrags */ rxmaxfrags = atoi(as->parms[38].items->data); } @@ -21,7 +21,7 @@ index 141dc69..ab8e560 100644 /* parse cacheinfo file if this is a diskcache */ if (ParseCacheInfoFile()) { -@@ -2588,6 +2592,7 @@ afsd_init(void) +@@ -2590,6 +2594,7 @@ afsd_init(void) cmd_AddParm(ts, "-rxmaxfrags", CMD_SINGLE, CMD_OPTIONAL, "Set the maximum number of UDP fragments Rx should send/receive" " per Rx packet"); diff --git a/debian/patches/0003-Linux-4.5-get_link-instead-of-follow_link-put_link.patch b/debian/patches/0003-Linux-4.5-get_link-instead-of-follow_link-put_link.patch new file mode 100644 index 000000000..80c7b0d79 --- /dev/null +++ b/debian/patches/0003-Linux-4.5-get_link-instead-of-follow_link-put_link.patch @@ -0,0 +1,77 @@ +From: Chaskiel Grundman +Date: Thu, 5 May 2016 12:35:08 -0400 +Subject: Linux 4.5: get_link instead of follow_link+put_link + +In linux commit 6b255391, the follow_link inode operation was +replaced by the get_link operation, which is basically the same +but takes the inode and dentry separately, allowing for the +possibility of staying in RCU mode. + +For now, only support this if page_get_link is available and we are +using the USABLE_KERNEL_PAGE_SYMLINK_CACHE + +The previous test for USABLE_KERNEL_PAGE_SYMLINK_CACHE used a bogus, +undefined configure variable (ac_cv_linux_kernel_page_follow_link). +Remove it, as it was not needed + +Change-Id: I2d7851d31dd4b1b944b16fad611addb804930eca +(cherry picked from commit bb9322c933894167b48fb763d38518ebfacdade7) +--- + acinclude.m4 | 10 +++++++++- + src/afs/LINUX/osi_vnodeops.c | 4 +++- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/acinclude.m4 b/acinclude.m4 +index c8a7ceb..aca1316 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -890,6 +890,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) + AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h]) + AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h]) + AC_CHECK_LINUX_STRUCT([inode_operations], [truncate], [fs.h]) ++ AC_CHECK_LINUX_STRUCT([inode_operations], [get_link], [fs.h]) + AC_CHECK_LINUX_STRUCT([key], [payload.value], [key.h]) + AC_CHECK_LINUX_STRUCT([key_type], [instantiate_prep], [key-type.h]) + AC_CHECK_LINUX_STRUCT([key_type], [match_preparse], [key-type.h]) +@@ -990,6 +991,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) + AC_CHECK_LINUX_FUNC([page_follow_link], + [#include ], + [page_follow_link(0,0);]) ++ AC_CHECK_LINUX_FUNC([page_get_link], ++ [#include ], ++ [page_get_link(0,0,0);]) + AC_CHECK_LINUX_FUNC([page_offset], + [#include ], + [page_offset(NULL);]) +@@ -1168,11 +1172,15 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) + if test -f "$LINUX_KERNEL_PATH/include/linux/mm_inline.h"; then + AC_DEFINE(HAVE_MM_INLINE_H, 1, [define if you have mm_inline.h header file]) + fi +- if test "x$ac_cv_linux_kernel_page_follow_link" = "xyes" -o "x$ac_cv_linux_func_i_put_link_takes_cookie" = "xyes"; then ++ if test "x$ac_cv_linux_func_page_get_link" = "xyes" -o "x$ac_cv_linux_func_i_put_link_takes_cookie" = "xyes"; then + AC_DEFINE(USABLE_KERNEL_PAGE_SYMLINK_CACHE, 1, [define if your kernel has a usable symlink cache API]) + else + AC_MSG_WARN([your kernel does not have a usable symlink cache API]) + fi ++ if test "x$ac_cv_linux_func_page_get_link" != "xyes" -a "x$ac_cv_linux_struct_inode_operations_has_get_link" = "xyes"; then ++ AC_MSG_ERROR([Your kernel does not use follow_link - not supported without symlink cache API]) ++ exit 1 ++ fi + : + fi + if test "x$enable_linux_d_splice_alias_extra_iput" = xyes; then +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index 2f753dd..00b41ef 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -3108,7 +3108,9 @@ static struct address_space_operations afs_symlink_aops = { + static struct inode_operations afs_symlink_iops = { + #if defined(USABLE_KERNEL_PAGE_SYMLINK_CACHE) + .readlink = page_readlink, +-# if defined(HAVE_LINUX_PAGE_FOLLOW_LINK) ++# if defined(HAVE_LINUX_PAGE_GET_LINK) ++ .get_link = page_get_link, ++# elif defined(HAVE_LINUX_PAGE_FOLLOW_LINK) + .follow_link = page_follow_link, + # else + .follow_link = page_follow_link_light, diff --git a/debian/patches/0004-Linux-4.5-don-t-access-i_mutex-directly.patch b/debian/patches/0004-Linux-4.5-don-t-access-i_mutex-directly.patch new file mode 100644 index 000000000..caaaa6075 --- /dev/null +++ b/debian/patches/0004-Linux-4.5-don-t-access-i_mutex-directly.patch @@ -0,0 +1,85 @@ +From: Benjamin Kaduk +Date: Sun, 1 May 2016 19:48:40 -0400 +Subject: Linux 4.5: don't access i_mutex directly + +Linux commit 5955102c, in preparation for future work, introduced +wrapper functions to lock/unlock inode mutexes. This is to +prepare for converting it to a read-write semaphore, so that +lookup can be done with only the shared lock held. + +Adopt the afs_linux_*lock_inode() functions accordingly, and +convert afs_linux_fsync() to using those wrappers, since the +FOP_FSYNC_TAKES_RANGE case appears to be the current case. + +Amusingly, afs_linux_*lock_inode() already have a branch to +handle the case when inode serialization is protected by a +semaphore; it seems that this is going to come full-circle. + +Change-Id: Ia5a194acc559de21808655ef066151a0a3826364 +(cherry picked from commit 7969ba9e50472a90c8423da06d0013d278f6fc99) +--- + acinclude.m4 | 3 +++ + src/afs/LINUX/osi_compat.h | 8 ++++++-- + src/afs/LINUX/osi_vnodeops.c | 4 ++-- + 3 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/acinclude.m4 b/acinclude.m4 +index aca1316..aa682ea 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -1041,6 +1041,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) + AC_CHECK_LINUX_FUNC([inode_nohighmem], + [#include ], + [inode_nohighmem(NULL);]) ++ AC_CHECK_LINUX_FUNC([inode_lock], ++ [#include ], ++ [inode_lock(NULL);]) + + dnl Consequences - things which get set as a result of the + dnl above tests +diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h +index 4d484c1..5268e7e 100644 +--- a/src/afs/LINUX/osi_compat.h ++++ b/src/afs/LINUX/osi_compat.h +@@ -427,7 +427,9 @@ afs_init_sb_export_ops(struct super_block *sb) { + + static inline void + afs_linux_lock_inode(struct inode *ip) { +-#ifdef STRUCT_INODE_HAS_I_MUTEX ++#if defined(HAVE_LINUX_INODE_LOCK) ++ inode_lock(ip); ++#elif defined(STRUCT_INODE_HAS_I_MUTEX) + mutex_lock(&ip->i_mutex); + #else + down(&ip->i_sem); +@@ -436,7 +438,9 @@ afs_linux_lock_inode(struct inode *ip) { + + static inline void + afs_linux_unlock_inode(struct inode *ip) { +-#ifdef STRUCT_INODE_HAS_I_MUTEX ++#if defined(HAVE_LINUX_INODE_LOCK) ++ inode_unlock(ip); ++#elif defined(STRUCT_INODE_HAS_I_MUTEX) + mutex_unlock(&ip->i_mutex); + #else + up(&ip->i_sem); +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index 00b41ef..2696b48 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -571,13 +571,13 @@ afs_linux_fsync(struct file *fp, int datasync) + cred_t *credp = crref(); + + #if defined(FOP_FSYNC_TAKES_RANGE) +- mutex_lock(&ip->i_mutex); ++ afs_linux_lock_inode(ip); + #endif + AFS_GLOCK(); + code = afs_fsync(VTOAFS(ip), credp); + AFS_GUNLOCK(); + #if defined(FOP_FSYNC_TAKES_RANGE) +- mutex_unlock(&ip->i_mutex); ++ afs_linux_unlock_inode(ip); + #endif + crfree(credp); + return afs_convert_code(code); diff --git a/debian/patches/series b/debian/patches/series index 58bc02e5f..4b5bc7422 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,4 @@ 0003-Add-dummy-exit-command-for-afsd-to-do-nothing.patch +0002-Linux-4.5-no-highmem-in-symlink-ops.patch +0003-Linux-4.5-get_link-instead-of-follow_link-put_link.patch +0004-Linux-4.5-don-t-access-i_mutex-directly.patch