Whamcloud - gitweb
LU-9868 llite: handle DCACHE_PAR_LOOKUP in ll_dcompare 86/28486/24
authorNeilBrown <neilb@suse.com>
Mon, 1 Oct 2018 18:19:05 +0000 (14:19 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 11 Feb 2019 03:21:43 +0000 (03:21 +0000)
commit32e547aa9cb913f5736ee3d58cb79f4e63ce2c0b
tree366fcf6e7ed34eebffc94172d99581110b8fcc9f
parent23bae7dc21b5c955c096431d485e49a7298ec404
LU-9868 llite: handle DCACHE_PAR_LOOKUP in ll_dcompare

ll_dcompare is used in two slightly different contexts.
It is called (from __d_lookup, __d_lookup_rcu, and d_exact_alias)
to compare a name against a dentry that is already in the dcache.
It is also called (from d_alloc_parallel) to compare a name against
a dentry that is not in the dcache yet, but is part of an active
"lookup" or "atomic_open" call.

In the first case we need to avoid matching against "invalid" dentries
as a match implies something about ldlm locks which is not accurate.
In the second case we need to allow matching against "invalid" dentries
as the dentry will always be invalid (set by ll_d_init()) but we still
want to guard against multiple concurrent lookups of the same name.
d_alloc_parallel() will repeat the call to ll_dcompare() after
the lookup has finished, and if the dentry is still invalid, the whole
d_alloc_parallel() process is repeated.  This assures us that it is safe
to report success whenever d_in_lookup().

With this patch, there will never be two threads concurrently in
ll_lookup_nd(), looking up the same name in the same directory.

Linux-commit: a22c3d41d187dc3cdaf41166ef0a20b8663fdfee

Change-Id: If489a6f2bbc5c0974570583e3d5083cf77a3b950
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/28486
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/include/lustre_compat.h
lustre/llite/dcache.c