From: Andrew Burford Date: Sun, 15 May 2022 01:02:19 +0000 (-0400) Subject: add self-stack patch that removes check preventing self-stacking X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=ce482587aaef9823bf5821635dd94dbfed97fca6;p=wrapfs-mgmt.git add self-stack patch that removes check preventing self-stacking --- diff --git a/bug-fixes/andrew-fix-self-stack2.patch b/bug-fixes/andrew-fix-self-stack2.patch new file mode 100644 index 0000000..87cd6f5 --- /dev/null +++ b/bug-fixes/andrew-fix-self-stack2.patch @@ -0,0 +1,39 @@ +diff --git a/fs/wrapfs/lookup.c b/fs/wrapfs/lookup.c +index 7c78d5a4a30f..b166c0e50b98 100644 +--- a/fs/wrapfs/lookup.c ++++ b/fs/wrapfs/lookup.c +@@ -260,7 +260,14 @@ static struct dentry *__wrapfs_lookup(struct dentry *dentry, + err = -ENOMEM; + goto out; + } +- d_add(lower_dentry, NULL); /* instantiate and hash */ ++ ++ /* ++ * Calling ->lookup instead of d_add will give the lower fs a chance ++ * to allocate the d_fsdata field but will still instantiate and hash the ++ * lower_dentry. Without this, wrapfs could not stack on top of itself. ++ */ ++ d_inode(lower_dir_dentry) ++ ->i_op->lookup(d_inode(lower_dir_dentry), lower_dentry, flags); + + setup_lower: + lower_path.dentry = lower_dentry; +diff --git a/fs/wrapfs/main.c b/fs/wrapfs/main.c +index 15c97a78d765..b5d7c178324c 100644 +--- a/fs/wrapfs/main.c ++++ b/fs/wrapfs/main.c +@@ -39,14 +39,6 @@ static int wrapfs_read_super(struct super_block *sb, void *raw_data, int silent) + goto out; + } + +- if (lower_path.dentry->d_sb->s_type == &wrapfs_fs_type) { +- err = -EINVAL; +- printk(KERN_ERR "Mount on filesystem of type " +- "wrapfs explicitly disallowed due to " +- "known incompatibilities\n"); +- goto out_pput; +- } +- + if (mnt_user_ns(lower_path.mnt) != &init_user_ns) { + err = -EINVAL; + printk(KERN_ERR "Mounting on idmapped mounts currently "