Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1398663

Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems

From James Bottomley <James.Bottomley@HansenPartnership.com>
Newsgroups linux.kernel
Subject Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems
Date 2016-05-11 05:50 +0200
Message-ID <rxtjQ-8qN-3@gated-at.bofh.it> (permalink)
References (3 earlier) <rvq6K-7IA-17@gated-at.bofh.it> <rvzto-86w-15@gated-at.bofh.it> <rvzD3-9z-1@gated-at.bofh.it> <rxppU-4nc-15@gated-at.bofh.it> <rxqFk-5B4-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 2016-05-11 at 01:53 +0100, Al Viro wrote:
> On Tue, May 10, 2016 at 04:36:56PM -0700, James Bottomley wrote:
> > +static int shiftfs_rename2(struct inode *olddir, struct dentry
> > *old,
> > +			   struct inode *newdir, struct dentry
> > *new,
> > +			   unsigned int flags)
> > +{
> > +	struct dentry *rodd = olddir->i_private, *rndd = newdir
> > ->i_private,
> > +		*realold = old->d_inode->i_private,
> > +		*realnew = new->d_inode->i_private;
> > +	struct inode *realolddir = rodd->d_inode, *realnewdir =
> > rndd->d_inode;
> > +	const struct inode_operations *iop = realolddir->i_op;
> > +	int err;
> > +	const struct cred *oldcred, *newcred;
> > +
> > +	oldcred = shiftfs_new_creds(&newcred, old->d_sb);
> > +	err = iop->rename2(realolddir, realold, realnewdir,
> > realnew, flags);
> > +	shiftfs_old_creds(oldcred, &newcred);
> 
> ... and you've just violated all locking rules for ->rename2().

Yes, sorry, somehow I missed that when I converted everything else to
the vfs_ functions.

> > +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;
> > +
> > +	/* note: violation of usual fs rules here: dentries are
> > never
> > +	 * added with d_add.  This is because we want no dentry
> > cache
> > +	 * for shiftfs.  All lookups proceed through the dentry
> > cache
> > +	 * of the underlying filesystem, meaning we always see any
> > +	 * changes in the underlying */
> 
> Bloody wonderful.  So
> 	* we lose caching the negative lookups

We do?  They should be cached in the underlying layer's dcache. If
that's not enough, I can hash them, but I was trying to avoid doubling
the dcache size.

> 	* we've got buggered hardlinks (different inodes for those)

Yes, had a note to do the lookup, but forgot.

> 	* it has never, ever been tried on -next (would do rather nasty
> things on that d_instantiate())

So this is just a proof of concept; I figured it was best to do it
against current rather than have people who wanted to try it pull in
your tree.  I can respin it after the merge window closes.

> 
> > +
> > +	kfree(sfc);
> > +
> > +	return err;
> > +}
> 
> > +	file->f_op = &sfc->fop;
> 
> Lovely - now try that with underlying fs something built modular.
> 
> Or try to use it on top of something with non-trivial
> dentry_operations
> (hell, on top of itself, for starters).

So if I add the missing fops_get/put, you're happy with the way this
hijacks f_op and f_inode?

James

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Djalal Harouni <tixxdz@gmail.com> - 2016-05-04 16:50 +0200
  [RFC v2 PATCH 1/8] VFS: add CLONE_MNTNS_SHIFT_UIDGID flag to allow mounts to shift their UIDs/GIDs Djalal Harouni <tixxdz@gmail.com> - 2016-05-04 16:50 +0200
  Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Josh Triplett <josh@joshtriplett.org> - 2016-05-04 18:40 +0200
  Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-05-04 23:10 +0200
    Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Djalal Harouni <tixxdz@gmail.com> - 2016-05-05 09:40 +0200
      Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-05-05 14:00 +0200
        Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Djalal Harouni <tixxdz@gmail.com> - 2016-05-06 00:00 +0200
          Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-05-06 00:10 +0200
            Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-05-11 01:40 +0200
              Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Al Viro <viro@ZenIV.linux.org.uk> - 2016-05-11 02:40 +0200
              Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Al Viro <viro@ZenIV.linux.org.uk> - 2016-05-11 03:00 +0200
                Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-05-11 05:50 +0200
              Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Djalal Harouni <tixxdz@gmail.com> - 2016-05-11 18:50 +0200
                Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-05-11 20:40 +0200
  Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Serge Hallyn <serge.hallyn@ubuntu.com> - 2016-05-05 01:40 +0200
    Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Djalal Harouni <tixxdz@gmail.com> - 2016-05-06 16:40 +0200
      Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Serge Hallyn <serge.hallyn@ubuntu.com> - 2016-05-09 18:30 +0200
        Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Djalal Harouni <tixxdz@gmail.com> - 2016-05-10 12:40 +0200
  Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Dave Chinner <david@fromorbit.com> - 2016-05-05 02:30 +0200
    Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Andy Lutomirski <luto@amacapital.net> - 2016-05-05 03:50 +0200
      Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Dave Chinner <david@fromorbit.com> - 2016-05-05 04:30 +0200
        Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Andy Lutomirski <luto@amacapital.net> - 2016-05-05 05:40 +0200
      Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Djalal Harouni <tixxdz@gmail.com> - 2016-05-06 00:40 +0200
    Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Djalal Harouni <tixxdz@gmail.com> - 2016-05-06 00:30 +0200
      Re: [RFC v2 PATCH 0/8] VFS:userns: support portable root filesystems Dave Chinner <david@fromorbit.com> - 2016-05-06 05:00 +0200

csiph-web