--- /dev/null
+From: Anders Kaseorg <andersk@mit.edu>
+Date: Tue, 6 Dec 2016 10:48:31 -0500
+Subject: AFS_component_version_number.c: Respect SOURCE_DATE_EPOCH if set
+
+To improve build reproducibility, if the SOURCE_DATE_EPOCH environment
+variable is set, use it to deterministically replace the embedded build
+date, and do not include the username or hostname in this case.
+
+https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal
+
+Change-Id: I9ba951f1836385ffd14aad95f071bf8c672a01bb
+(cherry picked from commit 21055d8f80b1a6214e4e25e6118e14c916a00fa5)
+---
+ src/config/Makefile.version-NOCML.in | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/config/Makefile.version-NOCML.in b/src/config/Makefile.version-NOCML.in
+index 325baa4..a286009 100644
+--- a/src/config/Makefile.version-NOCML.in
++++ b/src/config/Makefile.version-NOCML.in
+@@ -11,7 +11,11 @@ AFS_component_version_number.o: AFS_component_version_number.c
+
+ AFS_component_version_number.c: @TOP_OBJDIR@/src/config/Makefile.version
+ ( VERSION=`@abs_top_srcdir@/build-tools/git-version @abs_top_srcdir@ "@VERSION@"` && \
+- echo 'char cml_version_number[]="@(#)OpenAFS '$$VERSION `date +"%Y-%m-%d"` $$USER@`hostname`'";' >AFS_component_version_number.c.NEW && \
++ if [ "$$SOURCE_DATE_EPOCH" ]; then \
++ echo 'char cml_version_number[]="@(#)OpenAFS '$$VERSION `date -u -d "@$$SOURCE_DATE_EPOCH" +"%Y-%m-%d" 2>/dev/null || date -u -r "$$SOURCE_DATE_EPOCH" +"%Y-%m-%d" 2>/dev/null || date -u +"%Y-%m-%d"`'";'; \
++ else \
++ echo 'char cml_version_number[]="@(#)OpenAFS '$$VERSION `date +"%Y-%m-%d"` $$USER@`hostname`'";'; \
++ fi >AFS_component_version_number.c.NEW && \
+ echo 'char* AFSVersion = "${PACKAGE} '$$VERSION'";' >>AFS_component_version_number.c.NEW && \
+ if cmp AFS_component_version_number.c.NEW AFS_component_version_number.c > /dev/null 2>&1 ; then : ; else \
+ mv AFS_component_version_number.c.NEW AFS_component_version_number.c ; fi )
Subject: Add dummy -exit command for afsd to do nothing
---
- src/afsd/afsd.c | 5 +++++
- 1 file changed, 5 insertions(+)
+ src/afsd/afsd.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c
-index 0d5f413..d5d014f 100644
+index 0976099..fcf3988 100644
--- a/src/afsd/afsd.c
+++ b/src/afsd/afsd.c
-@@ -1911,6 +1911,10 @@ mainproc(struct cmd_syndesc *as, void *arock)
- /* -rxmaxfrags */
- rxmaxfrags = atoi(as->parms[38].items->data);
+@@ -362,6 +362,7 @@ enum optionsList {
+ OPT_dynrootsparse,
+ OPT_rxmaxfrags,
+ OPT_inumcalc,
++ OPT_exit,
+ };
+
+ #ifdef MACOS_EVENT_HANDLING
+@@ -1905,6 +1906,10 @@ CheckOptions(struct cmd_syndesc *as)
+ if (cmd_OptionPresent(as, OPT_inumcalc)) {
+ cmd_OptionAsString(as, OPT_inumcalc, &inumcalc);
}
+ if (as->parms[39].items) {
+ /* -exit */
/* parse cacheinfo file if this is a diskcache */
if (ParseCacheInfoFile()) {
-@@ -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");
-+ cmd_AddParm(ts, "-exit", CMD_FLAG, CMD_OPTIONAL, "exit immediately");
+@@ -2624,6 +2629,8 @@ afsd_init(void)
+ "send/receive per Rx packet");
+ cmd_AddParmAtOffset(ts, OPT_inumcalc, "-inumcalc", CMD_SINGLE, CMD_OPTIONAL,
+ "Set inode number calculation method");
++ cmd_AddParmAtOffset(ts, OPT_exit, "-exit", CMD_FLAG, CMD_OPTIONAL,
++ "exit immediately");
}
- int
+ /**
+++ /dev/null
-From 246ac68baddf44731ea402442d99a932e50b5b84 Mon Sep 17 00:00:00 2001
-From: Anders Kaseorg <andersk@mit.edu>
-Date: Sun, 4 Dec 2016 17:26:46 -0500
-Subject: [PATCH] AFS_component_version_number.c: Respect SOURCE_DATE_EPOCH if
- set
-
-This enables better build reproducibility.
-
-https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal
-
-Change-Id: Id379543a4782a7c1267eaa3d9258751d857cc07b
----
- src/config/Makefile.version-NOCML.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/config/Makefile.version-NOCML.in b/src/config/Makefile.version-NOCML.in
-index c8ab053c4..83313d26b 100644
---- a/src/config/Makefile.version-NOCML.in
-+++ b/src/config/Makefile.version-NOCML.in
-@@ -11,7 +11,7 @@ AFS_component_version_number.o: AFS_component_version_number.c
-
- AFS_component_version_number.c: @TOP_OBJDIR@/src/config/Makefile.version
- ( VERSION=`@abs_top_srcdir@/build-tools/git-version @abs_top_srcdir@ "@VERSION@"` && \
-- echo 'char cml_version_number[]="@(#) OpenAFS '$$VERSION' built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c.NEW && \
-+ echo 'char cml_version_number[]="@(#) OpenAFS '$$VERSION' built ' `date +"%Y-%m-%d" $${SOURCE_DATE_EPOCH:+-d "@$$SOURCE_DATE_EPOCH"}` '";' >AFS_component_version_number.c.NEW && \
- echo 'char* AFSVersion = "${PACKAGE} '$$VERSION'";' >>AFS_component_version_number.c.NEW && \
- if cmp AFS_component_version_number.c.NEW AFS_component_version_number.c > /dev/null 2>&1 ; then : ; else \
- mv AFS_component_version_number.c.NEW AFS_component_version_number.c ; fi )
---
-2.11.0
-
+++ /dev/null
-From 83a174de588c56cedbf13e6abab786fb56e8082f Mon Sep 17 00:00:00 2001
-From: Mark Vitale <mvitale@sinenomine.net>
-Date: Thu, 4 Aug 2016 18:42:27 -0400
-Subject: LINUX: do not use d_invalidate to evict dentries
-
-When working within the AFS filespace, commands which access large
-numbers of OpenAFS files (e.g., git operations and builds) may result in
-active files (e.g., the current working directory) being evicted from the
-dentry cache. One symptom of this is the following message upon return
-to the shell prompt:
-
-"fatal: unable to get current working directory: No such file or
-directory"
-
-Starting with Linux 3.18, d_invalidate returns void because it always
-succeeds. Commit a42f01d5ebb13da575b3123800ee6990743155ab adapted
-OpenAFS to cope with the new return type, but not with the changed
-semantics of d_invalidate. Because d_invalidate can no longer fail with
--EBUSY when invoked on an in-use dentry. OpenAFS must no longer trust it
-to preserve in-use dentries.
-
-Modify the dentry eviction code to use a method (d_prune_aliases) that
-does not evict in-use dentries.
-
-Reviewed-on: https://gerrit.openafs.org/12363
-Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
-Tested-by: Benjamin Kaduk <kaduk@mit.edu>
-(cherry picked from commit c3bbf0b4444db88192eea4580ac9e9ca3de0d286)
-
-Change-Id: Ic72a280f136cc414b54d4b8ec280f225290df122
----
- src/afs/LINUX/osi_vcache.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c
-index bc74b6744..23040b12c 100644
---- a/src/afs/LINUX/osi_vcache.c
-+++ b/src/afs/LINUX/osi_vcache.c
-@@ -24,6 +24,13 @@ TryEvictDentries(struct vcache *avc)
- struct hlist_node *p;
- #endif
-
-+#if defined(D_INVALIDATE_IS_VOID)
-+ /* At this kernel level, d_invalidate always succeeds;
-+ * that is, it will now invalidate even an active directory,
-+ * Therefore we must use a different method to evict dentries.
-+ */
-+ d_prune_aliases(inode);
-+#else
- #if defined(HAVE_DCACHE_LOCK)
- spin_lock(&dcache_lock);
-
-@@ -78,6 +85,7 @@ restart:
- spin_unlock(&inode->i_lock);
- #endif /* HAVE_DCACHE_LOCK */
- inuse:
-+#endif /* D_INVALIDATE_IS_VOID */
- return;
- }
-
---
-2.11.0
-
+++ /dev/null
-From cb2e2c26dc841bb4cab2d3b2ff376936f6c39e68 Mon Sep 17 00:00:00 2001
-From: Mark Vitale <mvitale@sinenomine.net>
-Date: Thu, 4 Aug 2016 18:18:15 -0400
-Subject: LINUX: split dentry eviction from osi_TryEvictVCache
-
-To make osi_TryEvictVCache clearer, and to prepare for a future change
-in dentry eviction, split the dentry eviction logic into its own routine
-osi_TryEvictDentries.
-
-No functional difference should be incurred by this commit.
-
-Reviewed-on: https://gerrit.openafs.org/12362
-Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
-Tested-by: BuildBot <buildbot@rampaginggeek.com>
-Reviewed-by: Joe Gorse <jhgorse@gmail.com>
-(cherry picked from commit 742643e306929ac979ab69515a33ee2a3f2fa3fa)
-
-Change-Id: I750fc7606ca56e784a60bdbc13a32d21fe307429
----
- src/afs/LINUX/osi_vcache.c | 103 +++++++++++++++++++++++++--------------------
- 1 file changed, 57 insertions(+), 46 deletions(-)
-
-diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c
-index 8a0c57899..3682bdc29 100644
---- a/src/afs/LINUX/osi_vcache.c
-+++ b/src/afs/LINUX/osi_vcache.c
-@@ -15,77 +15,88 @@
-
- #include "osi_compat.h"
-
--int
--osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) {
-- int code;
--
-+void
-+osi_TryEvictDentries(struct vcache *avc)
-+{
- struct dentry *dentry;
- struct inode *inode = AFSTOV(avc);
- #if defined(D_ALIAS_IS_HLIST) && !defined(HLIST_ITERATOR_NO_NODE)
- struct hlist_node *p;
- #endif
-
-- /* First, see if we can evict the inode from the dcache */
-- if (defersleep && avc != afs_globalVp && VREFCOUNT(avc) > 1 && avc->opens == 0) {
-- *slept = 1;
-- AFS_FAST_HOLD(avc);
-- ReleaseWriteLock(&afs_xvcache);
-- AFS_GUNLOCK();
--
- #if defined(HAVE_DCACHE_LOCK)
-- spin_lock(&dcache_lock);
-+ spin_lock(&dcache_lock);
-
- restart:
-- list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
-- if (d_unhashed(dentry))
-- continue;
-- dget_locked(dentry);
--
-- spin_unlock(&dcache_lock);
-- if (d_invalidate(dentry) == -EBUSY) {
-- dput(dentry);
-- /* perhaps lock and try to continue? (use cur as head?) */
-- goto inuse;
-- }
-+ list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
-+ if (d_unhashed(dentry))
-+ continue;
-+ dget_locked(dentry);
-+
-+ spin_unlock(&dcache_lock);
-+ if (d_invalidate(dentry) == -EBUSY) {
- dput(dentry);
-- spin_lock(&dcache_lock);
-- goto restart;
-+ /* perhaps lock and try to continue? (use cur as head?) */
-+ goto inuse;
- }
-- spin_unlock(&dcache_lock);
-+ dput(dentry);
-+ spin_lock(&dcache_lock);
-+ goto restart;
-+ }
-+ spin_unlock(&dcache_lock);
- #else /* HAVE_DCACHE_LOCK */
-- spin_lock(&inode->i_lock);
-+ spin_lock(&inode->i_lock);
-
- restart:
- #if defined(D_ALIAS_IS_HLIST)
- # if defined(HLIST_ITERATOR_NO_NODE)
-- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
-+ hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
- # else
-- hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) {
-+ hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) {
- # endif
- #else
-- list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
-+ list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
- #endif
-- spin_lock(&dentry->d_lock);
-- if (d_unhashed(dentry)) {
-- spin_unlock(&dentry->d_lock);
-- continue;
-- }
-+ spin_lock(&dentry->d_lock);
-+ if (d_unhashed(dentry)) {
- spin_unlock(&dentry->d_lock);
-- dget(dentry);
--
-- spin_unlock(&inode->i_lock);
-- if (afs_d_invalidate(dentry) == -EBUSY) {
-- dput(dentry);
-- /* perhaps lock and try to continue? (use cur as head?) */
-- goto inuse;
-- }
-- dput(dentry);
-- spin_lock(&inode->i_lock);
-- goto restart;
-+ continue;
- }
-+ spin_unlock(&dentry->d_lock);
-+ dget(dentry);
-+
- spin_unlock(&inode->i_lock);
-+ if (afs_d_invalidate(dentry) == -EBUSY) {
-+ dput(dentry);
-+ /* perhaps lock and try to continue? (use cur as head?) */
-+ goto inuse;
-+ }
-+ dput(dentry);
-+ spin_lock(&inode->i_lock);
-+ goto restart;
-+ }
-+ spin_unlock(&inode->i_lock);
- #endif /* HAVE_DCACHE_LOCK */
- inuse:
-+ return;
-+}
-+
-+
-+int
-+osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep)
-+{
-+ int code;
-+
-+ /* First, see if we can evict the inode from the dcache */
-+ if (defersleep && avc != afs_globalVp && VREFCOUNT(avc) > 1
-+ && avc->opens == 0) {
-+ *slept = 1;
-+ AFS_FAST_HOLD(avc);
-+ ReleaseWriteLock(&afs_xvcache);
-+ AFS_GUNLOCK();
-+
-+ osi_TryEvictDentries(avc);
-+
- AFS_GLOCK();
- ObtainWriteLock(&afs_xvcache, 733);
- AFS_FAST_RELE(avc);
---
-2.11.0
-
+++ /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
-
+++ /dev/null
-From f31b673509664714b146f23be069b69be7e1ac89 Mon Sep 17 00:00:00 2001
-From: Benjamin Kaduk <kaduk@mit.edu>
-Date: Thu, 27 Oct 2016 17:27:26 -0500
-Subject: Reformat src/afs/LINUX/osi_vcache.c
-
-Apply the GNU indent options from CODING, with manual adjustments
-to leave jump labels in column zero.
-
-Also rename and mark static a function-local helper function.
-
-Reviewed-on: https://gerrit.openafs.org/12422
-Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
-Tested-by: BuildBot <buildbot@rampaginggeek.com>
-(cherry picked from commit 22933e02e2510f25b79230964f135571c7bfe710)
-
-Change-Id: I9fb2886ae2213218ae80ea9d5b80540b9c79077b
----
- src/afs/LINUX/osi_vcache.c | 23 ++++++++++++++---------
- 1 file changed, 14 insertions(+), 9 deletions(-)
-
-diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c
-index 3682bdc29..bc74b6744 100644
---- a/src/afs/LINUX/osi_vcache.c
-+++ b/src/afs/LINUX/osi_vcache.c
-@@ -10,13 +10,13 @@
- #include <afsconfig.h>
- #include "afs/param.h"
-
--#include "afs/sysincludes.h" /*Standard vendor system headers */
--#include "afsincludes.h" /*AFS-based standard headers */
-+#include "afs/sysincludes.h" /*Standard vendor system headers */
-+#include "afsincludes.h" /*AFS-based standard headers */
-
- #include "osi_compat.h"
-
--void
--osi_TryEvictDentries(struct vcache *avc)
-+static void
-+TryEvictDentries(struct vcache *avc)
- {
- struct dentry *dentry;
- struct inode *inode = AFSTOV(avc);
-@@ -95,7 +95,7 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep)
- ReleaseWriteLock(&afs_xvcache);
- AFS_GUNLOCK();
-
-- osi_TryEvictDentries(avc);
-+ TryEvictDentries(avc);
-
- AFS_GLOCK();
- ObtainWriteLock(&afs_xvcache, 733);
-@@ -103,7 +103,7 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep)
- }
-
- /* See if we can evict it from the VLRUQ */
-- if (VREFCOUNT_GT(avc,0) && !VREFCOUNT_GT(avc,1) && avc->opens == 0
-+ if (VREFCOUNT_GT(avc, 0) && !VREFCOUNT_GT(avc, 1) && avc->opens == 0
- && (avc->f.states & CUnlinkedDel) == 0) {
- int didsleep = *slept;
-
-@@ -145,17 +145,22 @@ osi_NewVnode(void)
- }
-
- void
--osi_PrePopulateVCache(struct vcache *avc) {
-+osi_PrePopulateVCache(struct vcache *avc)
-+{
- avc->uncred = 0;
- memset(&(avc->f), 0, sizeof(struct fvcache));
- avc->cred = NULL;
- }
-
- void
--osi_AttachVnode(struct vcache *avc, int seq) { /* Nada */ }
-+osi_AttachVnode(struct vcache *avc, int seq)
-+{
-+ /* Nada */
-+}
-
- void
--osi_PostPopulateVCache(struct vcache *avc) {
-+osi_PostPopulateVCache(struct vcache *avc)
-+{
- vSetType(avc, VREG);
- }
-
---
-2.11.0
-
+++ /dev/null
-From 163fcc59b919877ee01d4fd47be46009e97a5e60 Mon Sep 17 00:00:00 2001
-From: Michael Meffie <mmeffie@sinenomine.net>
-Date: Thu, 27 Aug 2015 13:06:05 -0400
-Subject: afs: shake harder in shake-loose-vcaches
-
-Linux based cache managers will allocate vcaches on demand and
-deallocate batches of vcaches in the background. This feature is called
-dynamic vcaches.
-
-Vcaches to be deallocated are found by traversing the vcache LRU list
-(VLRU) from the oldest vcache to the newest. Up to a target number of
-vcaches are attempted to be evicted. The afs_xvcache lock protecting
-the VLRU may be dropped and re-acquired while attempting to evict a
-vcache. When this happens, it is possible the VLRU may have changed, so
-the traversal of the VLRU is restarted. This restarting of the VLRU
-transversal is limited to 100 iterations to avoid looping indefinitely.
-
-Vcaches which are busy cannot be evicted and remain in the VLRU. When a
-busy cache was not evicted and the afs_xvache lock was dropped, the VLRU
-traversal is restarted from the end of the VLRU. When the busy vcache is
-encountered on the retry, it will trigger additional retries until the
-loop limit is reached, at which point the target number of vcaches will
-not be deallocated.
-
-This can leave a very large number of unbusy vcaches which are never
-deallocated. On a busy machine, tens of millions of unused vcaches can
-remain in memory. When the busy vcache at the end of the VLRU is finally
-evicted, the log jam is broken, and the background deamon will hold the
-afs_xvcache lock for an excessively long time, hanging the system.
-
-Fix this by moving busy vcaches to the head of the VLRU before
-restarting the VLRU traversal. These busy vcaches will be skipped when
-retrying the VLRU traversal, allowing the cache manager to make progress
-deallocating vcaches down to the target level.
-
-This was already done on the mac osx platform while attempting to evict
-vcaches. Move the code to move busy vcaches to the head of the VLRU up
-the the platform agnostic caller.
-
-Thanks to Andrew Deason for the initial version of this patch.
-
-Reviewed-on: https://gerrit.openafs.org/11654
-Tested-by: BuildBot <buildbot@rampaginggeek.com>
-Reviewed-by: Andrew Deason <adeason@dson.org>
-Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
-(cherry picked from commit 5c136c7d93ed97166f39bf716cc7f5d579b70677)
-
-Change-Id: If60b1889d012a739aa5b43e842abb80a6ebfdb6a
----
- src/afs/DARWIN/osi_vcache.c | 5 +----
- src/afs/afs_vcache.c | 14 +++++++++++++-
- 2 files changed, 14 insertions(+), 5 deletions(-)
-
-diff --git a/src/afs/DARWIN/osi_vcache.c b/src/afs/DARWIN/osi_vcache.c
-index 18d8d9a08..1a1199c4c 100644
---- a/src/afs/DARWIN/osi_vcache.c
-+++ b/src/afs/DARWIN/osi_vcache.c
-@@ -53,10 +53,7 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) {
- * this out, since the iocount we have to hold makes it
- * always "fail" */
- if (AFSTOV(avc) == tvp) {
-- if (*slept) {
-- QRemove(&avc->vlruq);
-- QAdd(&VLRU, &avc->vlruq);
-- }
-+ /* Caller will move this vcache to the head of the VLRU. */
- return 0;
- } else
- return 1;
-diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c
-index d751a564c..ca5a956ea 100644
---- a/src/afs/afs_vcache.c
-+++ b/src/afs/afs_vcache.c
-@@ -725,6 +725,7 @@ int
- afs_ShakeLooseVCaches(afs_int32 anumber)
- {
- afs_int32 i, loop;
-+ int evicted;
- struct vcache *tvc;
- struct afs_q *tq, *uq;
- int fv_slept, defersleep = 0;
-@@ -752,12 +753,23 @@ afs_ShakeLooseVCaches(afs_int32 anumber)
- }
-
- fv_slept = 0;
-- if (osi_TryEvictVCache(tvc, &fv_slept, defersleep))
-+ evicted = osi_TryEvictVCache(tvc, &fv_slept, defersleep);
-+ if (evicted) {
- anumber--;
-+ }
-
- if (fv_slept) {
- if (loop++ > 100)
- break;
-+ if (!evicted) {
-+ /*
-+ * This vcache was busy and we slept while trying to evict it.
-+ * Move this busy vcache to the head of the VLRU so vcaches
-+ * following this busy vcache can be evicted during the retry.
-+ */
-+ QRemove(&tvc->vlruq);
-+ QAdd(&VLRU, &tvc->vlruq);
-+ }
- goto retry; /* start over - may have raced. */
- }
- if (uq == &VLRU) {
---
-2.11.0
-
0003-Add-dummy-exit-command-for-afsd-to-do-nothing.patch
-LINUX-split-dentry-eviction-from-osi_TryEvictVCache.patch
-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
-AFS_component_version_number.c-Respect-SOURCE_DATE_E.patch
+0002-AFS_component_version_number.c-Respect-SOURCE_DATE_E.patch