Re: [RFC][PATCHSET v3] non-recursive pathname resolution & RCU symlinks

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

 



On Fri, May 15, 2015 at 08:37:20PM -0700, Linus Torvalds wrote:
> On May 15, 2015 8:17 PM, "Al Viro" <viro@xxxxxxxxxxxxxxxxxx> wrote:
> >
> >         What for?  All we need is a flag, waitqueue and being woken
> > up when the flag gets cleared.
> 
> You need to have the flag somewhere.
> 
> The child dentry doesn't exist yet.
> 
> That's the point of the hashed entry. It approximates the not-yet-existing
> child dentry that we have *not* added to the parent until after lookup.

Point, but...  A lot of our problems comes from the fact that ->i_mutex
doubles as protection against the addition to the list of children, on
top of protection of directory itself.  What if we do the following:
have the normal case of __lookup_hash() (and other callers of lookup_real())
	* allocate dentry, marked "in-lookup"
	* do dcache lookup, likely to come up empty, _without_ touching
potential matches' d_lock, i.e. based on __d_lookup_rcu() (under
rcu_read_lock(), with rename_lock loop around it).  Hold parent's ->d_lock
while walking the chain, grab refcount in the unlikely case the match had
been found.  If nothing's found *and* rename_lock hadn't been touched, insert
the new dentry into hash and list of children before dropping ->d_lock.
	* call ->lookup() (still under ->i_mutex, shared)
	* clear "in-lookup" bit on _original_ dentry (we might very well
have returned a different one)
	* kick the wait queue of parent's ->i_mutex

I'll need to think about that after I get some sleep, but it smells like
that could be feasible.  Of course, that assumes we'll be able to cope
with hashed-but-currently-in-lookup dentries, but I think it might be
doable with some massage...
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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