name cache: lookup semantics match nfs41_lookup() on NOENT
previously, when the name cache encountered a missing/negative/expired entry, it returned the previous two entries as 'target' and 'parent', and nfs41_lookup() started new lookups from the filehandle in 'target'. this differs from nfs41_lookup(), which on NOENT will return NULL for the 'target' and the previous entry as 'parent'. modified name_cache_lookup() to do the same, and updated nfs41_lookup() to start new lookups from the filehandle in 'parent' now when nfs41_lookup() gets the is_negative flag from nfs41_name_cache_lookup(), it can just return the error without needing to copy the 'target' to 'parent' Signed-off-by: Casey Bodley <cbodley@umich.edu>
This commit is contained in:
parent
765bc0284b
commit
794dfeca49
2 changed files with 12 additions and 12 deletions
|
|
@ -458,14 +458,14 @@ int nfs41_lookup(
|
||||||
if (status == NO_ERROR || negative)
|
if (status == NO_ERROR || negative)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (target_out->fh.len) {
|
if (parent_out->fh.len) {
|
||||||
/* start where the name cache left off */
|
/* start where the name cache left off */
|
||||||
if (target_out != &target) {
|
if (&parent != parent_out) {
|
||||||
/* must make a copy for server_start, because
|
/* must make a copy for server_start, because
|
||||||
* server_lookup_loop() will overwrite target_out */
|
* server_lookup_loop() will overwrite parent_out */
|
||||||
path_fh_copy(&target, target_out);
|
path_fh_copy(&parent, parent_out);
|
||||||
}
|
}
|
||||||
server_start = ⌖
|
server_start = &parent;
|
||||||
} else {
|
} else {
|
||||||
/* start with PUTROOTFH */
|
/* start with PUTROOTFH */
|
||||||
server_start = NULL;
|
server_start = NULL;
|
||||||
|
|
|
||||||
|
|
@ -595,7 +595,7 @@ static int name_cache_lookup(
|
||||||
OUT OPTIONAL struct name_cache_entry **target_out,
|
OUT OPTIONAL struct name_cache_entry **target_out,
|
||||||
OUT OPTIONAL bool_t *is_negative)
|
OUT OPTIONAL bool_t *is_negative)
|
||||||
{
|
{
|
||||||
struct name_cache_entry *parent, *target, *tmp;
|
struct name_cache_entry *parent, *target;
|
||||||
nfs41_component component;
|
nfs41_component component;
|
||||||
const char *path_pos;
|
const char *path_pos;
|
||||||
int status = NO_ERROR;
|
int status = NO_ERROR;
|
||||||
|
|
@ -613,17 +613,16 @@ static int name_cache_lookup(
|
||||||
}
|
}
|
||||||
|
|
||||||
while (next_component(path_pos, path_end, &component)) {
|
while (next_component(path_pos, path_end, &component)) {
|
||||||
tmp = name_cache_search(cache, target, &component);
|
parent = target;
|
||||||
if (tmp == NULL || (skip_invis && entry_invis(tmp, is_negative))) {
|
target = name_cache_search(cache, parent, &component);
|
||||||
|
path_pos = component.name + component.len;
|
||||||
|
if (target == NULL || (skip_invis && entry_invis(target, is_negative))) {
|
||||||
if (is_last_component(component.name, path_end))
|
if (is_last_component(component.name, path_end))
|
||||||
status = ERROR_FILE_NOT_FOUND;
|
status = ERROR_FILE_NOT_FOUND;
|
||||||
else
|
else
|
||||||
status = ERROR_PATH_NOT_FOUND;
|
status = ERROR_PATH_NOT_FOUND;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parent = target;
|
|
||||||
target = tmp;
|
|
||||||
path_pos = component.name + component.len;
|
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
if (remaining_path_out) *remaining_path_out = component.name;
|
if (remaining_path_out) *remaining_path_out = component.name;
|
||||||
|
|
@ -812,7 +811,8 @@ int nfs41_name_cache_lookup(
|
||||||
|
|
||||||
if (parent_out) copy_fh(parent_out, parent);
|
if (parent_out) copy_fh(parent_out, parent);
|
||||||
if (target_out) copy_fh(target_out, target);
|
if (target_out) copy_fh(target_out, target);
|
||||||
if (info_out && target) copy_attrs(info_out, target->attributes);
|
if (info_out && target && target->attributes)
|
||||||
|
copy_attrs(info_out, target->attributes);
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
ReleaseSRWLockShared(&cache->lock);
|
ReleaseSRWLockShared(&cache->lock);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue