6c13e5ff419be757b53d29cd75ed8d78fba4ac0f
[openwrt.git] / target / linux / generic / patches-4.1 / 040-fs-overlay-fix-stacking.patch
1 From 1c8a47df36d72ace8cf78eb6c228aa0f8027d3c2 Mon Sep 17 00:00:00 2001
2 From: Miklos Szeredi <miklos@szeredi.hu>
3 Date: Mon, 12 Oct 2015 15:56:20 +0200
4 Subject: ovl: fix open in stacked overlay
5
6 If two overlayfs filesystems are stacked on top of each other, then we need
7 recursion in ovl_d_select_inode().
8
9 I guess d_backing_inode() is supposed to do that.  But currently it doesn't
10 and that functionality is open coded in vfs_open().  This is now copied
11 into ovl_d_select_inode() to fix this regression.
12
13 Reported-by: Alban Crequy <alban.crequy@gmail.com>
14 Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
15 Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay...")
16 Cc: David Howells <dhowells@redhat.com>
17 Cc: <stable@vger.kernel.org> # v4.2+
18 ---
19  fs/overlayfs/inode.c | 3 +++
20  1 file changed, 3 insertions(+)
21
22 --- a/fs/overlayfs/inode.c
23 +++ b/fs/overlayfs/inode.c
24 @@ -375,6 +375,9 @@ struct inode *ovl_d_select_inode(struct
25                 ovl_path_upper(dentry, &realpath);
26         }
27  
28 +       if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE)
29 +               return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags);
30 +
31         return d_backing_inode(realpath.dentry);
32  }
33