From dbbfff38591b764a28f3f99e436e26e46f46a600 Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@windriver.com>
Date: Fri, 17 Aug 2012 16:13:40 -0400
Subject: [PATCH] unionfs: update unionfs fork to align with mainline

1/1 [
Author: Liang Li
Email: liang.li@windriver.com
Subject: unionfs: update unionfs fork to align with mainline
Date: Thu, 16 Aug 2012 21:25:01 +0800

mainline commit 0145acc [vfs: uninline full_name_hash] changes the
interface to full_name_hash, so unionfs fork must be updated.
Otherwise unionfs might have the odd behavior that newly created
directories/files in unionfs won't show up in underlying fs properly.

This also implies that 0145acc fixes the corner issue/regression that
introduced by mainline commit bfcfaa7 [vfs: use 'unsigned long'
accesses for dcache name comparison and hashing] and e419b4c [vfs:
make word-at-a-time accesses handle a non-existing page], that newly
adopted fast hash function might have hash collision issue on x86.

Signed-off-by: Liang Li <liang.li@windriver.com>
]

Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
 ...-unionfs-fork-to-align-with-mainline.patch | 53 +++++++++++++++++++
 features/unionfs/unionfs.scc                  |  1 +
 2 files changed, 54 insertions(+)
 create mode 100644 features/unionfs/unionfs-update-unionfs-fork-to-align-with-mainline.patch

diff --git a/features/unionfs/unionfs-update-unionfs-fork-to-align-with-mainline.patch b/features/unionfs/unionfs-update-unionfs-fork-to-align-with-mainline.patch
new file mode 100644
index 000000000..3bc691b11
--- /dev/null
+++ b/features/unionfs/unionfs-update-unionfs-fork-to-align-with-mainline.patch
@@ -0,0 +1,53 @@
+From 9f0fe583ffc5116584d8c4800a7fa28bb4ff9b09 Mon Sep 17 00:00:00 2001
+From: Liang Li <liang.li@windriver.com>
+Date: Thu, 16 Aug 2012 21:25:01 +0800
+Subject: [PATCH] unionfs: update unionfs fork to align with mainline
+
+mainline commit 0145acc [vfs: uninline full_name_hash] changes the
+interface to full_name_hash, so unionfs fork must be updated.
+Otherwise unionfs might have the odd behavior that newly created
+directories/files in unionfs won't show up in underlying fs properly.
+
+This also implies that 0145acc fixes the corner issue/regression that
+introduced by mainline commit bfcfaa7 [vfs: use 'unsigned long'
+accesses for dcache name comparison and hashing] and e419b4c [vfs:
+make word-at-a-time accesses handle a non-existing page], that newly
+adopted fast hash function might have hash collision issue on x86.
+
+Signed-off-by: Liang Li <liang.li@windriver.com>
+---
+ fs/namei.c |    6 ++----
+ 1 files changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/fs/namei.c b/fs/namei.c
+index de81292..afb6cc8 100644
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -1889,7 +1889,6 @@ struct dentry *lookup_one_len_nd(const char *name, struct dentry *base,
+ 				 int len, struct nameidata *nd)
+ {
+ 	struct qstr this;
+-	unsigned long hash;
+ 	unsigned int c;
+ 
+ 	WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex));
+@@ -1899,14 +1898,13 @@ struct dentry *lookup_one_len_nd(const char *name, struct dentry *base,
+ 	if (!len)
+ 		return ERR_PTR(-EACCES);
+ 
+-	hash = init_name_hash();
++	this.hash = full_name_hash(name, len);
++
+ 	while (len--) {
+ 		c = *(const unsigned char *)name++;
+ 		if (c == '/' || c == '\0')
+ 			return ERR_PTR(-EACCES);
+-		hash = partial_name_hash(c, hash);
+ 	}
+-	this.hash = end_name_hash(hash);
+ 	/*
+ 	 * See if the low-level filesystem might want
+ 	 * to use its own hash..
+-- 
+1.7.5.4
+
diff --git a/features/unionfs/unionfs.scc b/features/unionfs/unionfs.scc
index 46574ca25..0c6484cf0 100644
--- a/features/unionfs/unionfs.scc
+++ b/features/unionfs/unionfs.scc
@@ -7,3 +7,4 @@ patch unionfs-v3.4-build-fixups.patch
 patch unionfs-change-end_writeback-to-clear_inode.patch
 patch Unionfs-update-show_options-prototype.patch
 patch Unionfs-use-mode_t.patch
+patch unionfs-update-unionfs-fork-to-align-with-mainline.patch
-- 
GitLab