[PATCH] ovl: detect distributed fs also by looking into default dentry operations
From: Konstantin Khlebnikov
Date: Sun Jan 31 2016 - 08:22:39 EST
For example fuse root dentry has no dentry operations.
Signed-off-by: Konstantin Khlebnikov <koct9i@xxxxxxxxx>
Fixes: 7c03b5d45b8e ("ovl: allow distributed fs as lower layer")
---
fs/overlayfs/super.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 1a354840f262..7a236865d56c 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -365,6 +365,14 @@ static bool ovl_dentry_remote(struct dentry *dentry)
(DCACHE_OP_REVALIDATE | DCACHE_OP_WEAK_REVALIDATE);
}
+static bool ovl_path_remote(const struct path *path)
+{
+ const struct dentry_operations *d_op = path->dentry->d_sb->s_d_op;
+
+ return ovl_dentry_remote(path->dentry) ||
+ (d_op && (d_op->d_revalidate || d_op->d_weak_revalidate));
+}
+
static bool ovl_dentry_weird(struct dentry *dentry)
{
return dentry->d_flags & (DCACHE_NEED_AUTOMOUNT |
@@ -837,7 +845,7 @@ static int ovl_mount_dir(const char *name, struct path *path)
err = ovl_mount_dir_noesc(tmp, path);
if (!err)
- if (ovl_dentry_remote(path->dentry)) {
+ if (ovl_path_remote(path)) {
pr_err("overlayfs: filesystem on '%s' not supported as upperdir\n",
tmp);
path_put(path);
@@ -866,7 +874,7 @@ static int ovl_lower_dir(const char *name, struct path *path, long *namelen,
*namelen = max(*namelen, statfs.f_namelen);
*stack_depth = max(*stack_depth, path->mnt->mnt_sb->s_stack_depth);
- if (ovl_dentry_remote(path->dentry))
+ if (ovl_path_remote(path))
*remote = true;
return 0;