name cache: LINK inserts target to name cache

the link part of basic test7 was failing because LINK's target was still cached as a negative entry, leading to the error "can't stat newfile.0 after link".  the solution is to replace the negative entry with the real fh and attributes of the target file

so instead of doing RESTOREFH+GETATTR on the source file and calling nfs41_attr_cache_update(), nfs41_link() uses LOOKUP+GETATTR+GETFH to get attributes for the target file and passes them to nfs41_name_cache_insert() along with dst_dir's changeinfo.  because the source and target file will have the same fileid attribute, nfs41_name_cache_insert() will update the attributes of both at the same time.  added the target file as an optional return parameter

Signed-off-by: Casey Bodley <cbodley@umich.edu>
This commit is contained in:
Casey Bodley 2010-10-11 16:08:54 -04:00
parent 7db2d60c3b
commit c72007f076
3 changed files with 59 additions and 30 deletions

View file

@ -367,7 +367,8 @@ int handle_nfs41_link(setattr_upcall_args *args)
}
}
status = nfs41_link(state->session, &state->file, &dst_dir, &dst_name);
status = nfs41_link(state->session, &state->file,
&dst_dir, &dst_name, NULL);
if (status) {
dprintf(1, "nfs41_link() failed with error %s.\n",
nfs_error_string(status));