040-fs-overlay-fix-stacking.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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. If two overlayfs filesystems are stacked on top of each other, then we need
  6. recursion in ovl_d_select_inode().
  7. I guess d_backing_inode() is supposed to do that. But currently it doesn't
  8. and that functionality is open coded in vfs_open(). This is now copied
  9. into ovl_d_select_inode() to fix this regression.
  10. Reported-by: Alban Crequy <alban.crequy@gmail.com>
  11. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
  12. Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay...")
  13. Cc: David Howells <dhowells@redhat.com>
  14. Cc: <stable@vger.kernel.org> # v4.2+
  15. ---
  16. fs/overlayfs/inode.c | 3 +++
  17. 1 file changed, 3 insertions(+)
  18. --- a/fs/overlayfs/inode.c
  19. +++ b/fs/overlayfs/inode.c
  20. @@ -383,6 +383,9 @@ struct inode *ovl_d_select_inode(struct
  21. ovl_path_upper(dentry, &realpath);
  22. }
  23. + if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE)
  24. + return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags);
  25. +
  26. return d_backing_inode(realpath.dentry);
  27. }