deleg: delegation support for name/attr cache

when a delegation is granted by OPEN, its delegation type is passed to nfs41_name_cache_insert().  as long as the delegation is held, its name_cache_entry is kept out of the cache.exp_entries list to prevent it from expiring.  an extra reference is held on the attr_cache_entry as well, so it sticks around even if the name_cache_entry is removed (a parent expires, for example).  new function nfs41_name_cache_delegreturn() adds the name_cache_entry back to the list, and releases the extra attr_cache_entry reference

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-07-06 11:05:45 -04:00 committed by unknown
parent ee71a62af2
commit 38259e0017
4 changed files with 124 additions and 32 deletions

View file

@ -223,8 +223,8 @@ static int server_lookup(
/* add the file handle and attributes to the name cache */
memcpy(&res->getrootattr.info->attrmask,
&res->getrootattr.obj_attributes.attrmask, sizeof(bitmap4));
nfs41_name_cache_insert(session_name_cache(session),
path, &name, &dir->fh, res->getrootattr.info, NULL);
nfs41_name_cache_insert(session_name_cache(session), path, &name,
&dir->fh, res->getrootattr.info, NULL, OPEN_DELEGATE_NONE);
}
file = dir;
@ -245,8 +245,8 @@ static int server_lookup(
if (parent_out) *parent_out = file;
} else if (res->lookup[i].status == NFS4ERR_NOENT) {
/* insert a negative lookup entry */
nfs41_name_cache_insert(session_name_cache(session),
path, args->lookup[i].name, NULL, NULL, NULL);
nfs41_name_cache_insert(session_name_cache(session), path,
args->lookup[i].name, NULL, NULL, NULL, OPEN_DELEGATE_NONE);
}
status = res->lookup[i].status; if (status) break;
@ -274,7 +274,7 @@ static int server_lookup(
&res->getattr[i].obj_attributes.attrmask, sizeof(bitmap4));
nfs41_name_cache_insert(session_name_cache(session),
path, args->lookup[i].name, &res->file[i].fh,
res->getattr[i].info, NULL);
res->getattr[i].info, NULL, OPEN_DELEGATE_NONE);
if (i == count-1) {
if (target_out)