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);