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)
|
||||
goto out;
|
||||
|
||||
if (target_out->fh.len) {
|
||||
if (parent_out->fh.len) {
|
||||
/* start where the name cache left off */
|
||||
if (target_out != &target) {
|
||||
if (&parent != parent_out) {
|
||||
/* must make a copy for server_start, because
|
||||
* server_lookup_loop() will overwrite target_out */
|
||||
path_fh_copy(&target, target_out);
|
||||
* server_lookup_loop() will overwrite parent_out */
|
||||
path_fh_copy(&parent, parent_out);
|
||||
}
|
||||
server_start = ⌖
|
||||
server_start = &parent;
|
||||
} else {
|
||||
/* start with PUTROOTFH */
|
||||
server_start = NULL;
|
||||
|
|
|
|||
|
|
@ -595,7 +595,7 @@ static int name_cache_lookup(
|
|||
OUT OPTIONAL struct name_cache_entry **target_out,
|
||||
OUT OPTIONAL bool_t *is_negative)
|
||||
{
|
||||
struct name_cache_entry *parent, *target, *tmp;
|
||||
struct name_cache_entry *parent, *target;
|
||||
nfs41_component component;
|
||||
const char *path_pos;
|
||||
int status = NO_ERROR;
|
||||
|
|
@ -613,17 +613,16 @@ static int name_cache_lookup(
|
|||
}
|
||||
|
||||
while (next_component(path_pos, path_end, &component)) {
|
||||
tmp = name_cache_search(cache, target, &component);
|
||||
if (tmp == NULL || (skip_invis && entry_invis(tmp, is_negative))) {
|
||||
parent = target;
|
||||
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))
|
||||
status = ERROR_FILE_NOT_FOUND;
|
||||
else
|
||||
status = ERROR_PATH_NOT_FOUND;
|
||||
break;
|
||||
}
|
||||
parent = target;
|
||||
target = tmp;
|
||||
path_pos = component.name + component.len;
|
||||
}
|
||||
out:
|
||||
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 (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:
|
||||
ReleaseSRWLockShared(&cache->lock);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue