Re: [PATCH 2/8] NFS: prepare for RCU-walk support but pushing tests later in code.

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

 



On Wed, 5 Mar 2014 05:34:41 +0000 Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:

> On Wed, Mar 05, 2014 at 02:00:28PM +1100, NeilBrown wrote:
> > -	parent = dget_parent(dentry);
> > +		parent = rcu_dereference(dentry->d_parent);
> > +	else
> > +		parent = dget_parent(dentry);
> >  	dir = parent->d_inode;
> >  	nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE);
> 

Hi Al,
 thanks for the review.

> ... and in RCU mode there's nothing to stop parent from
> 	a) not being dentry->d_parent anymore

Does that matter?  Surely dentry->d_parent exists, is still a dentry, and was
recently the parent to dentry (i.e. since the last grace period).  If it has
changed (which it must if it is no longer our parent), then the cache
validity checks are bound to fail and we will fall back to refcnt-walk as we
should.

> 	b) having already become negative.

I didn't think dentries ever became negative.  When a file is deleted the old
positive dentry is unlinked and a new negative dentry is created in it's
place.
Or has that changed since last I looked?

If they can become negative, then I could
   dir = ACCESS_ONCE(parent->d_inode);
   if (!dir)
        return -ECHILD;

Do you think that would be safe?

Thanks,
NeilBrown


> 
> NAK.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux