[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150516013853.GN7232@ZenIV.linux.org.uk>
Date: Sat, 16 May 2015 02:38:53 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: NeilBrown <neilb@...e.de>, Andreas Dilger <adilger@...ger.ca>,
Dave Chinner <david@...morbit.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Christoph Hellwig <hch@...radead.org>
Subject: Re: [RFC][PATCHSET v3] non-recursive pathname resolution & RCU
symlinks
On Fri, May 15, 2015 at 05:45:56PM -0700, Linus Torvalds wrote:
> Al, do you have any ideas? Personally, I've wanted to make I_mutex a
> rwsem for a long time, but right now pretty much everything uses it
> for exclusion. For example, filename lookup is clearly just reading
> the directory, so it should take a rwsem for reading, right? No. Not
> the way it is done now. Filename lookup wants the directory inode
> exclusively because that guarantees that we create just one dentry and
> call the filesystem ->lookup only once on that dentry.
rwsem by itself won't do us much good there. Look: for multiple lookups on
the same existing entry we could try to teach d_splice_alias() to cope,
etc. But what happens when a bunch of processes looks for the same
inexistent entry? And no, "who cares about fuckloads of negatives with
the same name" isn't a good answer - suppose we do mkdir() after that.
OK, so we'll find a negative dentry in dcache. And tell the filesystem
to create the sucker. Done. Made it positive. Now, do we hunt down
all _other_ negative dentries for it? Or never keep negative ones at
all. Or slap some kind of ->d_revalidate() there to catch all negative
dentries creates before the last mkdir/creat/mknod/symlink/link in given
parent?
One possibility would be a new dentry state - "being looked up". Hashed,
treated as "fall out of RCU mode" for lazy pathwalk purposes, and places
where we call ->lookup() would (while still holding ->i_mutex on parent
shared) wait for that state to end. Places where we call ->d_revalidate()
(with or without ->i_mutex on parent) would also wait on those.
It would need a careful analysis of tree-walkers, though. Doable, but there
might be dragons. In case of e.g. ceph - swamp ones, with mirror in the line
of sight...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists