LINUX-do-not-use-d_invalidate-to-evict-dentries.patch,
afs-shake-harder-in-shake-loose-vcaches.patch: Avoid system hangs on
busy machines due to vcache deallocation failures.
+ - Linux-4.9-deal-with-demise-of-GROUP_AT.patch,
+ Linux-4.9-inode_operation-rename-now-takes-flags.patch,
+ Linux-4.9-inode_change_ok-becomes-setattr_prepare.patch: Support
+ Linux kernel 4.9. (Closes: #847011)
-- Anders Kaseorg <andersk@mit.edu> Thu, 01 Dec 2016 00:13:01 -0500
--- /dev/null
+From 10fd7e53aa9086b6fba94dd3340517cbc7294655 Mon Sep 17 00:00:00 2001
+From: Mark Vitale <mvitale@sinenomine.net>
+Date: Wed, 14 Sep 2016 18:01:22 -0400
+Subject: Linux 4.9: deal with demise of GROUP_AT
+
+Linux commit 81243eacfa40 "cred: simpler, 1D supplementary groups"
+refactors the group_info struct, removing some members (which OpenAFS
+references only through the GROUP_AT macro) and adding a gid member.
+The GROUP_AT macro is also removed from the tree.
+
+Add an autoconfigure test for the new group_info member gid and define a
+replacement GROUP_AT macro to do the right thing under the new regime.
+
+Change-Id: I85a52c0ae0d91fc141a523f443a4ffc05eb72a2b
+Reviewed-on: https://gerrit.openafs.org/12390
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit 8e81b182e36cde28ec5708e5fcbe56e4900b1ea3)
+---
+ acinclude.m4 | 1 +
+ src/afs/LINUX/osi_machdep.h | 5 +++++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index c645c3d03..38eefceb6 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -878,6 +878,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
+ AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
+ AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_alias], [dcache.h])
+ AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h])
++ AC_CHECK_LINUX_STRUCT([group_info], [gid], [cred.h])
+ AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
+ AC_CHECK_LINUX_STRUCT([inode], [i_blkbits], [fs.h])
+ AC_CHECK_LINUX_STRUCT([inode], [i_blksize], [fs.h])
+diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
+index 54efc99b6..4448fdcfd 100644
+--- a/src/afs/LINUX/osi_machdep.h
++++ b/src/afs/LINUX/osi_machdep.h
+@@ -146,6 +146,11 @@ static inline long copyinstr(char *from, char *to, int count, int *length) {
+ #define NGROUPS NGROUPS_SMALL
+ #endif
+
++#ifdef STRUCT_GROUP_INFO_HAS_GID
++/* compat macro for Linux 4.9 */
++#define GROUP_AT(gi,x) ((gi)->gid[x])
++#endif
++
+ typedef struct task_struct afs_proc_t;
+
+ #ifdef HAVE_LINUX_KUID_T
+--
+2.11.0
+
--- /dev/null
+From 89199cf23e8d61bc010eebb45c987d531927f3b2 Mon Sep 17 00:00:00 2001
+From: Mark Vitale <mvitale@sinenomine.net>
+Date: Thu, 20 Oct 2016 00:49:37 -0400
+Subject: Linux 4.9: inode_change_ok() becomes setattr_prepare()
+
+Linux commit 31051c85b5e2 "fs: Give dentry to inode_change_ok() instead
+of inode" renames and modifies inode_change_ok(inode, attrs) to
+setattr_prepare(dentry, attrs).
+
+Modify OpenAFS to cope.
+
+Change-Id: I72f8dfbdbd25d7c775e9c35116e323ea4359e95c
+Reviewed-on: https://gerrit.openafs.org/12418
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit 8aeb711eeaa5ddac5a74c354091e2d4f7ac0cd63)
+---
+ acinclude.m4 | 3 +++
+ src/afs/LINUX/osi_file.c | 4 ++++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index c9291bfdb..966d05d8f 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -1020,6 +1020,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
+ AC_CHECK_LINUX_FUNC([set_nlink],
+ [#include <linux/fs.h>],
+ [set_nlink(NULL, 1);])
++ AC_CHECK_LINUX_FUNC([setattr_prepare],
++ [#include <linux/fs.h>],
++ [setattr_prepare(NULL, NULL);])
+ AC_CHECK_LINUX_FUNC([sock_create_kern],
+ [#include <linux/net.h>],
+ [sock_create_kern(0, 0, 0, NULL);])
+diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c
+index ea0ea5d23..b230c0bf5 100644
+--- a/src/afs/LINUX/osi_file.c
++++ b/src/afs/LINUX/osi_file.c
+@@ -184,7 +184,11 @@ osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
+ newattrs.ia_ctime = CURRENT_TIME;
+
+ /* avoid notify_change() since it wants to update dentry->d_parent */
++#ifdef HAVE_LINUX_SETATTR_PREPARE
++ code = setattr_prepare(file_dentry(afile->filp), &newattrs);
++#else
+ code = inode_change_ok(inode, &newattrs);
++#endif
+ if (!code)
+ code = afs_inode_setattr(afile, &newattrs);
+ if (!code)
+--
+2.11.0
+
--- /dev/null
+From b025473a664a5dcbdeb496aafebace60820377e1 Mon Sep 17 00:00:00 2001
+From: Mark Vitale <mvitale@sinenomine.net>
+Date: Fri, 16 Sep 2016 19:01:19 -0400
+Subject: Linux 4.9: inode_operation rename now takes flags
+
+In Linux 3.15 commit 520c8b16505236fc82daa352e6c5e73cd9870cff,
+inode_operation rename2() was added. It takes the same arguments as
+rename(), with an added flags argument supporting the following values:
+
+RENAME_NOREPLACE: if "new" name exists, fail with -EEXIST. Without
+this flag, the default behavior is to replace the "new" existing file.
+
+RENAME_EXCHANGE: exchange source and target; both must exist.
+
+OpenAFS never implemented a .rename2() routine because it was optional
+when introduced at Linux v3.15.
+
+In Linux 4.9-rc1 the following commits remove the last in-tree uses of
+.rename() and converts .rename2() to .rename().
+aadfa8019e81 vfs: add note about i_op->rename changes to porting
+2773bf00aeb9 fs: rename "rename2" i_op to "rename"
+18fc84dafaac vfs: remove unused i_op->rename
+1cd66c93ba8c fs: make remaining filesystems use .rename2
+e0e0be8a8355 libfs: support RENAME_NOREPLACE in simple_rename()
+f03b8ad8d386 fs: support RENAME_NOREPLACE for local filesystems
+
+With these changes, it is now mandatory for OpenAFS afs_linux_rename()
+to accept a 5th flag argument.
+
+Add an autoconfig test to determine the signature of .rename(). Use this
+information to implement afs_linux_rename() with the appropriate number
+of arguments. Implement "toleration support" for the flags option by
+treating a zero flag as a normal rename; if any flags are specified,
+return -EINVAL to indicate the OpenAFS filesystem does not yet support
+any flags.
+
+Change-Id: I165d2b7956942446d97beda8504ac1ed5185a036
+Reviewed-on: https://gerrit.openafs.org/12391
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit f21e3ef8ce5093b4e0578d29666f76bd99aef1a2)
+---
+ acinclude.m4 | 6 ++++++
+ src/afs/LINUX/osi_vnodeops.c | 11 ++++++++++-
+ 2 files changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 38eefceb6..c9291bfdb 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -854,6 +854,12 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
+ [#include <linux/fs.h>],
+ [void],
+ [struct inode *inode, void *link_data])
++ AC_CHECK_LINUX_OPERATION([inode_operations], [rename], [takes_flags],
++ [#include <linux/fs.h>],
++ [int],
++ [struct inode *oinode, struct dentry *odentry,
++ struct inode *ninode, struct dentry *ndentry,
++ unsigned int flags])
+
+ dnl Check for header files
+ AC_CHECK_LINUX_HEADER([config.h])
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index ce89ebfb2..4a8f0e9dc 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -1821,7 +1821,11 @@ afs_linux_rmdir(struct inode *dip, struct dentry *dp)
+
+ static int
+ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
+- struct inode *newip, struct dentry *newdp)
++ struct inode *newip, struct dentry *newdp
++#ifdef HAVE_LINUX_INODE_OPERATIONS_RENAME_TAKES_FLAGS
++ , unsigned int flags
++#endif
++ )
+ {
+ int code;
+ cred_t *credp = crref();
+@@ -1829,6 +1833,11 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
+ const char *newname = newdp->d_name.name;
+ struct dentry *rehash = NULL;
+
++#ifdef HAVE_LINUX_INODE_OPERATIONS_RENAME_TAKES_FLAGS
++ if (flags)
++ return -EINVAL; /* no support for new flags yet */
++#endif
++
+ /* Prevent any new references during rename operation. */
+
+ if (!d_unhashed(newdp)) {
+--
+2.11.0
+
Reformat-src-afs-LINUX-osi_vcache.c.patch
LINUX-do-not-use-d_invalidate-to-evict-dentries.patch
afs-shake-harder-in-shake-loose-vcaches.patch
+Linux-4.9-deal-with-demise-of-GROUP_AT.patch
+Linux-4.9-inode_operation-rename-now-takes-flags.patch
+Linux-4.9-inode_change_ok-becomes-setattr_prepare.patch