Re: [RFC PATCH v2 14/14] dcache: Implement object migration

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

 



On Wed, Apr 03, 2019 at 06:48:55PM +0100, Al Viro wrote:
> On Wed, Apr 03, 2019 at 06:19:21PM +0100, Al Viro wrote:
> > On Wed, Apr 03, 2019 at 06:08:11PM +0100, Al Viro wrote:
> > 
> > > Oh, *brilliant*
> > > 
> > > Let's do d_invalidate() on random dentries and hope they go away.
> > > With convoluted and brittle logics for deciding which ones to
> > > spare, which is actually wrong.  This will pick mountpoints
> > > and tear them out, to start with.
> > > 
> > > NAKed-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> > > 
> > > And this is a NAK for the entire approach; if it has a positive refcount,
> > > LEAVE IT ALONE.  Period.  Don't play this kind of games, they are wrong.
> > > d_invalidate() is not something that can be done to an arbitrary dentry.
> > 
> > PS: "try to evict what can be evicted out of this set" can be done, but
> > you want something like
> > 	start with empty list
> > 	go through your array of references
> > 		grab dentry->d_lock
> > 		if dentry->d_lockref.count is not zero
> > 			unlock and continue
> > 		if dentry->d_flags & DCACHE_SHRINK_LIST
> > 			ditto, it's not for us to play with
> >                 if (dentry->d_flags & DCACHE_LRU_LIST)
> >                         d_lru_del(dentry);
> > 		d_shrink_add(dentry, &list);
> > 		unlock
> > 
> > on the collection phase and
> > 	if the list is not empty by the end of that loop
> > 		shrink_dentry_list(&list);
> > on the disposal.
> 
> Note, BTW, that your constructor is wrong - all it really needs to do
> is spin_lock_init() and setting ->d_lockref.count same as lockref_mark_dead()
> does, to match the state of dentries being torn down.

Thanks for looking at this Al.

> __d_alloc() is not holding ->d_lock, since the object is not visible to
> anybody else yet; with your changes it *is* visible.

I don't quite understand this comment.  How is the object visible?  The
constructor is only called when allocating a new page to the slab and
this is done with interrupts disabled.

>  However, if the
> assignment to ->d_lockref.count in __d_alloc() is guaranteed to be
> non-zero to non-zero, the above should be safe.

I've done as you suggest and set it to -128

Thanks for schooling me on the VFS stuff.


	Tobin



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux