ovl: resurrect ovl_dentry_remote()
Amir Goldstein
maintainerPATCH 1/3 ovl: resurrect ovl_dentry_remote()
---
Miklos,
These patches are against overlayfs-next.
You'd probably want to squash this one.
Thanks,
Amir.
fs/overlayfs/overlayfs.h | 1 + fs/overlayfs/util.c | 6 ++++++ 2 files changed, 7 insertions(+)
fs/overlayfs/overlayfs.h +1 -0
@@ -229,6 +229,7 @@ struct dentry *ovl_indexdir(struct super_block *sb);bool ovl_index_all (struct super_block *sb);bool ovl_verify_lower (struct super_block *sb);struct ovl_entry *ovl_alloc_entry (unsigned int numlower); +bool ovl_dentry_remote (struct dentry *dentry);void ovl_dentry_update_reval (struct dentry *dentry,struct dentry *upperdentry,unsigned int mask);bool ovl_dentry_weird (struct dentry *dentry);
fs/overlayfs/util.c +6 -0
@@ -90,6 +90,12 @@ struct ovl_entry *ovl_alloc_entry(unsigned int numlower)return oe; } +bool ovl_dentry_remote (struct dentry *dentry) +{ +return dentry->d_flags & + (DCACHE_OP_REVALIDATE |DCACHE_OP_WEAK_REVALIDATE ); +} +void ovl_dentry_update_reval (struct dentry *dentry,struct dentry *upperdentry,unsigned int mask) {
Signature · 1 line
2.17.1
Amir Goldstein
maintainerPATCH 2/3 ovl: check if upper fs supports RENAME_WHITEOUT
As with other required upper fs features, we only warn if support is missing to avoid breaking existing sub-optimal setups.
--- fs/overlayfs/dir.c | 2 +- fs/overlayfs/overlayfs.h | 1 + fs/overlayfs/super.c | 69 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-)
fs/overlayfs/dir.c +1 -1
@@ -42,7 +42,7 @@ int ovl_cleanup(struct inode *wdir, struct dentry *wdentry)return err; } -static struct dentry *ovl_lookup_temp (struct dentry *workdir) +struct dentry *ovl_lookup_temp (struct dentry *workdir) {struct dentry *temp;char name[20 ];
fs/overlayfs/overlayfs.h +1 -0
@@ -448,6 +448,7 @@ struct ovl_cattr {struct dentry *ovl_create_real (struct inode *dir,struct dentry *newdentry,struct ovl_cattr *attr);int ovl_cleanup (struct inode *dir,struct dentry *dentry); +struct dentry *ovl_lookup_temp (struct dentry *workdir);struct dentry *ovl_create_temp (struct dentry *workdir,struct ovl_cattr *attr);/* file.c */
fs/overlayfs/super.c +69 -0
81 lines not on this page · raw message
Signature · 1 line
2.17.1
Amir Goldstein
maintainerPATCH 3/3 ovl: strict upper fs requirements for remote upper fs
In reply to Amir GoldsteinOverlayfs works sub-optimally with upper fs that has no xattr/d_type/O_TMPFILE/RENAME_WHITEOUT support. We should basically deprecate support for those filesystems, but so far, we only issue a warning and don't fail the mount for the sake of backward compat. Some features are already being disabled with no xattr support.
For newly supported remote upper fs, we do not need to worry about backward compatibility, so we can fail the mount if upper fs is a sub-optimal filesystem.
This reduces the in-tree remote filesystems supported as upper to just FUSE, for which the remote upper fs support was added.
--- fs/overlayfs/super.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
fs/overlayfs/super.c +18 -6
@@ -1136,6 +1136,8 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs, {struct vfsmount *mnt = ofs->upper_mnt;struct dentry *temp; +bool rename_whiteout; +bool d_type;int fh_type;int err;
@@ -1161,11 +1163,8 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,if (err <0 ) goto out; -/* -* We allowed this configuration and don't want to break users over -* kernel upgrade. So warn instead of erroring out. -*/ -if (!err) + d_type = err; +if (!d_type)pr_warn ("upper fs needs to support d_type.\n" );/* Check if upper/work fs supports O_TMPFILE */
@@ -1182,7 +1181,8 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,if (err <0 ) goto out; -if (!err) + rename_whiteout = err; +if (!rename_whiteout)pr_warn ("upper fs does not support RENAME_WHITEOUT.\n" );/*
@@ -1199,6 +1199,18 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,vfs_removexattr (ofs->workdir,OVL_XATTR_OPAQUE ); } +/* +* We allowed sub-optimal upper fs configuration and don't want to break +* users over kernel upgrade, but we never allowed remote upper fs, so +* we can enforce strict requirements for remote upper fs. +*/ +if (ovl_dentry_remote (ofs->workdir) && + (!d_type || !ofs->tmpfile || !rename_whiteout || ofs->noxattr)) { +pr_err ("upper fs missing required features.\n" ); + err = -EINVAL ; + goto out; + } +/* Check if upper/work fs supports file handles */ fh_type =ovl_can_decode_fh (ofs->workdir->d_sb);if (ofs->config.index && !fh_type) {
Signature · 1 line
2.17.1