Skip to content

Commit

Permalink
ovl: separate detection of remote upper layer from stacked overlay
Browse files Browse the repository at this point in the history
Following patch will allow remote as upper layer, but not overlay stacked
on upper layer.  Separate the two concepts.

This patch is doesn't change behavior.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Mar 17, 2020
1 parent 3bb7df9 commit 7925dad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion fs/overlayfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
if (err)
goto out;

if (upperdentry && unlikely(ovl_dentry_remote(upperdentry))) {
if (upperdentry && (upperdentry->d_flags & DCACHE_OP_REAL ||
unlikely(ovl_dentry_remote(upperdentry)))) {
dput(upperdentry);
err = -EREMOTE;
goto out;
Expand Down
14 changes: 7 additions & 7 deletions fs/overlayfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,13 +752,13 @@ static int ovl_mount_dir(const char *name, struct path *path)
ovl_unescape(tmp);
err = ovl_mount_dir_noesc(tmp, path);

if (!err)
if (ovl_dentry_remote(path->dentry)) {
pr_err("filesystem on '%s' not supported as upperdir\n",
tmp);
path_put_init(path);
err = -EINVAL;
}
if (!err && (ovl_dentry_remote(path->dentry) ||
path->dentry->d_flags & DCACHE_OP_REAL)) {
pr_err("filesystem on '%s' not supported as upperdir\n",
tmp);
path_put_init(path);
err = -EINVAL;
}
kfree(tmp);
}
return err;
Expand Down
3 changes: 1 addition & 2 deletions fs/overlayfs/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ struct ovl_entry *ovl_alloc_entry(unsigned int numlower)
bool ovl_dentry_remote(struct dentry *dentry)
{
return dentry->d_flags &
(DCACHE_OP_REVALIDATE | DCACHE_OP_WEAK_REVALIDATE |
DCACHE_OP_REAL);
(DCACHE_OP_REVALIDATE | DCACHE_OP_WEAK_REVALIDATE);
}

bool ovl_dentry_weird(struct dentry *dentry)
Expand Down

0 comments on commit 7925dad

Please sign in to comment.