Re: [PATCH v2] vfs: Don't exchange "short" filenames unconditionally.

From: Al Viro
Date: Fri Sep 26 2014 - 16:23:33 EST


On Thu, Sep 25, 2014 at 05:46:01AM +0100, Al Viro wrote:

> I really wonder if it's possible to get d_rehash() hitting the victim of
> (non-exchange) __d_move(). _Then_ this patch (as well as the historical
> behaviour it restores, all way back to 2.5, if not 2.3) would, indeed,
> be buggy.

More fun: what's going on in ceph_handle_notrace_create()? AFAICS, this
struct dentry *result = ceph_lookup(dir, dentry, 0);

if (result && !IS_ERR(result)) {
/*
* We created the item, then did a lookup, and found
* it was already linked to another inode we already
* had in our cache (and thus got spliced). Link our
* dentry to that inode, but don't hash it, just in
* case the VFS wants to dereference it.
*/
BUG_ON(!result->d_inode);
d_instantiate(dentry, result->d_inode);
return 0;
}
is bogus. What will happen if server goes nuts and that existing alias picked
by lookup turns out to be a directory? And while we are at it, what's to
prevent a leak if we ever hit that codepath, directory or no directory?
Sage?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/