Re: [RFC][PATCH 8/14] Union-mount lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 15, 2007 at 10:00:45AM -0400, Trond Myklebust wrote:
> On Mon, 2007-05-14 at 15:12 +0530, Bharata B Rao wrote:
> > From: Jan Blunck <[email protected]>
> > Subject: Union-mount lookup
> > 
> > Modifies the vfs lookup routines to work with union mounted directories.
> > 
> > The existing lookup routines generally lookup for a pathname only in the
> > topmost or given directory. The changed versions of the lookup routines
> > search for the pathname in the entire union mounted stack. Also they have been
> > modified to setup the union stack during lookup from dcache cache and from
> > real_lookup().
> > 
> > Signed-off-by: Jan Blunck <[email protected]>
> > Signed-off-by: Bharata B Rao <[email protected]>
> > ---
> >  fs/dcache.c            |   16 +
> >  fs/namei.c             |   78 +++++-
> >  fs/namespace.c         |   35 ++
> >  fs/union.c             |  598 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  include/linux/dcache.h |   17 +
> >  include/linux/namei.h  |    4 
> >  include/linux/union.h  |   49 ++++
> >  7 files changed, 786 insertions(+), 11 deletions(-)
> > 
> > --- a/fs/dcache.c
> > +++ b/fs/dcache.c
> > @@ -1286,7 +1286,7 @@ struct dentry * d_lookup(struct dentry *
> >  	return dentry;
> >  }
> >  
> > -struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
> > +struct dentry * __d_lookup_single(struct dentry *parent, struct qstr *name)
> >  {
> >  	unsigned int len = name->len;
> >  	unsigned int hash = name->hash;
> > @@ -1371,6 +1371,20 @@ out:
> >  	return dentry;
> >  }
> >  
> > +struct dentry * d_lookup_single(struct dentry *parent, struct qstr *name)
> > +{
> > +	struct dentry *dentry;
> > +	unsigned long seq;
> > +
> > +        do {
> > +                seq = read_seqbegin(&rename_lock);
> > +                dentry = __d_lookup_single(parent, name);
> > +                if (dentry)
> > +			break;
> > +	} while (read_seqretry(&rename_lock, seq));
> > +	return dentry;
> > +}
> > +
> >  /**
> >   * d_validate - verify dentry provided from insecure source
> >   * @dentry: The dentry alleged to be valid child of @dparent
> > --- a/fs/namei.c
> > +++ b/fs/namei.c
> > @@ -374,6 +374,33 @@ void release_open_intent(struct nameidat
> >  }
> >  
> >  static inline struct dentry *
> > +do_revalidate_single(struct dentry *dentry, struct nameidata *nd)
> > +{
> > +	int status = dentry->d_op->d_revalidate(dentry, nd);
> > +	if (unlikely(status <= 0)) {
> 
> d_revalidate() returns a 0 or 1 result, not an error.

Doesn't look like (see the comment below) because this is copied
as-is from do_revalidate().

> 
> > +		/*
> > +		 * The dentry failed validation.
> > +		 * If d_revalidate returned 0 attempt to invalidate
> > +		 * the dentry otherwise d_revalidate is asking us
> > +		 * to return a fail status.
> > +		 */
> > +		if (!status) {
> > +			if (!d_invalidate(dentry)) {
> > +				__dput_single(dentry);
> > +				dentry = NULL;
> > +			}
> > +		} else {
> > +			__dput_single(dentry);
> > +			dentry = ERR_PTR(status);

Regards,
Bharata.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux