Subject: linux 3.14.40 and patch-3.14.33-vs2.3.6.15.diff
From: Corey Wright <undefined@pobox.com>
Date: Thu, 30 Apr 2015 09:33:17 -0500
Thu, 30 Apr 2015 09:33:17 -0500
applying patch-3.14.33-vs2.3.6.15.diff to linux 3.14.40 fails in patching.

patching file fs/libfs.c
Hunk #1 FAILED at 145.
Hunk #2 FAILED at 159.
2 out of 3 hunks FAILED -- saving rejects to file fs/libfs.c.rej

upstream commit
http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/fs/libfs.c?h=linux-3.14.y&id=5c48ea64a86415fde0859267a194442d26d2e70c
invalidated the patch hunk contexts.

the attached patch accounts for the upstream change.

instructions:
1. acquire linux-3.14.40
2. apply patch-3.14.33-vs2.3.6.15.diff
4. manually fix the Makefile reject (EXTRAVERSION)
3. apply the attached patch-3.14.33-40-vs2.3.6.15.diff

i've successfully built the resulting kernel and tested it in virtualbox
against testme.sh and testfs.sh and started-entered-exited-stopped a vserver
guest.

the vserver patch hunks that failed (and that i subsequently provided a new
patch for) appears related to filtering of pts in /dev/pts, so i tested that
only the relevant pts appear in each context (host and guests), but i
encourage further review and testing.

corey
--
undefined@pobox.com


upstream commit broke linux-vserver patch hunk context
http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/fs/libfs.c?h=linux-3.14.y&id=5c48ea64a86415fde0859267a194442d26d2e70c

diff -urNpd linux-3.14.40~/fs/libfs.c linux-3.14.40/fs/libfs.c
--- linux-3.14.40~/fs/libfs.c	2015-04-29 08:13:04.220426335 -0500
+++ linux-3.14.40/fs/libfs.c	2015-04-29 08:19:35.763840939 -0500
@@ -145,13 +145,14 @@ static inline unsigned char dt_type(stru
  * both impossible due to the lock on directory.
  */
 
-int dcache_readdir(struct file *file, struct dir_context *ctx)
+static inline int do_dcache_readdir_filter(struct file *filp,
+	struct dir_context *ctx, int (*filter)(struct dentry *dentry))
 {
-	struct dentry *dentry = file->f_path.dentry;
-	struct dentry *cursor = file->private_data;
+	struct dentry *dentry = filp->f_path.dentry;
+	struct dentry *cursor = filp->private_data;
 	struct list_head *p, *q = &cursor->d_child;
 
-	if (!dir_emit_dots(file, ctx))
+	if (!dir_emit_dots(filp, ctx))
 		return 0;
 	spin_lock(&dentry->d_lock);
 	if (ctx->pos == 2)
@@ -159,6 +160,8 @@ int dcache_readdir(struct file *file, st
 
 	for (p = q->next; p != &dentry->d_subdirs; p = p->next) {
 		struct dentry *next = list_entry(p, struct dentry, d_child);
+		if (filter && !filter(next))
+			continue;
 		spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
 		if (!simple_positive(next)) {
 			spin_unlock(&next->d_lock);