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


Groups > linux.kernel > #1410790

Re: [PATCH 1/1] shiftfs: uid/gid shifting bind mount

From James Bottomley <James.Bottomley@HansenPartnership.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] shiftfs: uid/gid shifting bind mount
Date 2016-06-01 05:00 +0200
Message-ID <rF4xX-2zN-3@gated-at.bofh.it> (permalink)
References <rF2mu-1c3-13@gated-at.bofh.it> <rF2mu-1c3-17@gated-at.bofh.it> <rF4oh-2uT-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 2016-06-01 at 03:40 +0100, Al Viro wrote:
> On Tue, May 31, 2016 at 08:31:33PM -0400, James Bottomley wrote:
> 
> 
> > +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 */
> > +
> > +	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;
> > +
> > +	newi = shiftfs_new_inode(dentry->d_sb, new->d_inode
> > ->i_mode, new);
> > +	if (!newi) {
> > +		dput(new);
> > +		return ERR_PTR(-ENOMEM);
> > +	}
> > +
> > +	d_splice_alias(newi, dentry);
> > +
> > +	return NULL;
> 
> This is utter crap.  First of all, d_splice_alias() *WILL* hash them, 
> so you get all the coherency problems, in spades.  Moreover, if you 
> did manage to avoid hashing, you would get something absolutely
> unusable.
> 	* no mounting of anything on top of that thing
> 	* performance shot to hell
> and that's just for starters.  I hadn't looked into the locking and 
> semantics issues - those would really depends upon how you would 
> achieve that "no dentry cache" thing; again, right now that's *not*
> what your code is doing.

Yes, sorry, after the new BUG_ON in the d_invalidate() code I didn't
have much choice but to run two sets of dentry hashes; I'm afraid I
just forgot to remove the comment (I did remove the blurb about the
single dentry cache from the changelog).  I'll remove it (the comment)
in the next go around.

> PS: and then there's the choice of name.  I mean, just try to say it 
> over the phone several times in a row...

But I did that especially for you, Al ...

James

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


Thread

[PATCH 0/1] shiftfs: uid/gid shifting filesystem James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-06-01 02:40 +0200
  [PATCH 1/1] shiftfs: uid/gid shifting bind mount James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-06-01 02:40 +0200
    Re: [PATCH 1/1] shiftfs: uid/gid shifting bind mount Al Viro <viro@ZenIV.linux.org.uk> - 2016-06-01 04:50 +0200
      Re: [PATCH 1/1] shiftfs: uid/gid shifting bind mount James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-06-01 05:00 +0200
  Re: [PATCH 0/1] shiftfs: uid/gid shifting filesystem Michał Zegan <webczat_200@poczta.onet.pl> - 2016-06-01 15:10 +0200
  Re: [PATCH 0/1] shiftfs: uid/gid shifting filesystem Michał Zegan <webczat_200@poczta.onet.pl> - 2016-06-01 18:30 +0200
    Re: [PATCH 0/1] shiftfs: uid/gid shifting filesystem James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-06-01 18:50 +0200
      Re: [PATCH 0/1] shiftfs: uid/gid shifting filesystem Djalal Harouni <tixxdz@gmail.com> - 2016-06-05 23:20 +0200
        Re: [PATCH 0/1] shiftfs: uid/gid shifting filesystem James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-06-07 00:10 +0200
          Re: [PATCH 0/1] shiftfs: uid/gid shifting filesystem Djalal Harouni <tixxdz@gmail.com> - 2016-06-07 13:10 +0200

csiph-web