On Sat, Feb 04, 2017 at 11:19:32AM -0800, James Bottomley wrote:

> +static const struct dentry_operations shiftfs_dentry_ops = {
> +     .d_release      = shiftfs_d_release,
> +     .d_real         = shiftfs_d_real,
> +};

In other words, those dentries are *never* revalidated.  Nevermind that
underlying fs might be mounted elsewhere and be actively modified under
you.

> +static struct dentry *shiftfs_lookup(struct inode *dir, struct dentry 
> *dentry,
> +                                  unsigned int flags)
> +{
> +     struct dentry *real = dir->i_private, *new;
> +     struct inode *reali = real->d_inode, *newi;
> +     const struct cred *oldcred, *newcred;
> +
> +     inode_lock(reali);
> +     oldcred = shiftfs_new_creds(&newcred, dentry->d_sb);
> +     new = lookup_one_len(dentry->d_name.name, real, dentry->d_name.len);
> +     shiftfs_old_creds(oldcred, &newcred);
> +     inode_unlock(reali);
> +
> +     if (IS_ERR(new))
> +             return new;
> +
> +     dentry->d_fsdata = new;
> +
> +     if (!new->d_inode)
> +             return NULL;

What happens when somebody comes along and creates the damn thing on the
underlying fs?  _Not_ via your code, that is - using the underlying fs
mounted elsewhere.

Reply via email to