public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ovl: Add d_select_inode op to ovl_reval_dentry_operations
@ 2016-02-08 14:52 Nikolay Borisov
  0 siblings, 0 replies; only message in thread
From: Nikolay Borisov @ 2016-02-08 14:52 UTC (permalink / raw)
  To: miklos; +Cc: dhowells, linux-unionfs, linux-kernel, operations

Commit daee0af5b522 ("overlayfs: Make f_path always point to the
overlay and f_inode to the underlay") changed the way overlayed dentries
are opened and introduced ovl_d_select_inode so that in cases when an overlayed
file is opened its f_ops are being fetched from the underlying
(in the case of writes the upper directory) layer.

However, by not adding this operation to the ovl_reval_dentry_operations
this essentially disables writes to the upper layer in setups which
use a remote (as per the check in ovl_dentry_remote) lower layers, since
in this case ovl_reval_dentry_operations is going to be used when
dentries are created. This results in code in vfs_open never calling
d_select_inode to get the upper layer inode, which leads to do_dentry_open
using the overlay inode which has empty_fops.

This patch fixes this by adding d_select_inode operation to
ovl_reval_dentry_operations, which allows querying the correct inode
when writing to an overlayed location, using a remote lower dir.

Fixes: daee0af5b522 ("overlayfs: Make f_path always point to the
overlay and f_inode to the underlay")

Signed-off-by: Nikolay Borisov <kernel@kyup.com>
---

This took me quite a while to catch, and so far it survives local
testing. I'm mostly interested in knowing whether it (silently) 
breaks stuff. 

 fs/overlayfs/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index e38ee0fed24a..787e075709fa 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -321,6 +321,7 @@ static const struct dentry_operations ovl_dentry_operations = {
 
 static const struct dentry_operations ovl_reval_dentry_operations = {
 	.d_release = ovl_dentry_release,
+	.d_select_inode = ovl_d_select_inode,
 	.d_revalidate = ovl_dentry_revalidate,
 	.d_weak_revalidate = ovl_dentry_weak_revalidate,
 };
-- 
2.5.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-08 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-08 14:52 [PATCH] ovl: Add d_select_inode op to ovl_reval_dentry_operations Nikolay Borisov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox