From: Miklos Szeredi Date: Mon, 12 Oct 2015 13:56:20 +0000 (+0200) Subject: ovl: fix open in stacked overlay X-Git-Tag: v4.1.12-108.0.20170806_1300~49 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=be7d810e0217b7af18dd3513fcbfb209ac4bee60;p=users%2Fjedix%2Flinux-maple.git ovl: fix open in stacked overlay If two overlayfs filesystems are stacked on top of each other, then we need recursion in ovl_d_select_inode(). I guess d_backing_inode() is supposed to do that. But currently it doesn't and that functionality is open coded in vfs_open(). This is now copied into ovl_d_select_inode() to fix this regression. Reported-by: Alban Crequy Signed-off-by: Miklos Szeredi Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay...") Cc: David Howells Cc: # v4.2+ Orabug: 26401569 (backport upstream commit 1c8a47df36d72ace8cf78eb6c228aa0f8027d3c2) Signed-off-by: Shan Hai Reviewed-by: Somasundaram Krishnasamy --- diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index 9934bd993e786..9d41fc376bc9d 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -404,6 +404,9 @@ struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags) ovl_path_upper(dentry, &realpath); } + if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE) + return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags); + return d_backing_inode(realpath.dentry); }