symlink: rename and link handle ERROR_REPARSE

when rename or link call nfs41_lookup() for the destination directory, they need to be able to handle ERROR_REPARSE and find the real dest dir

open now does the same thing when it sees ERROR_REPARSE; previously, it was only replacing the first symlink in the path, and could require multiple reparses on a path

modified nfs41_symlink_target() to support the case where the source and destination paths are the same (used by rename/link)

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-10-15 14:30:41 -04:00 committed by unknown
parent e37b33a4df
commit 1ad1c0f262
3 changed files with 49 additions and 19 deletions

View file

@ -238,12 +238,20 @@ int handle_open(nfs41_upcall *upcall)
if (status == ERROR_REPARSE) {
/* one of the parent components was a symlink */
do {
/* replace the path with the symlink target's */
status = nfs41_symlink_target(state->session,
&state->parent, &state->path);
/* redo the lookup until it doesn't return REPARSE */
status = nfs41_lookup(args->root, state->session,
&state->path, &state->parent, NULL, NULL, &state->session);
} while (status == ERROR_REPARSE);
abs_path_copy(&args->symlink, &state->path);
status = NO_ERROR;
upcall->last_error = ERROR_REPARSE;
args->symlink_embedded = TRUE;
/* replace the path with the symlink target */
status = nfs41_symlink_target(state->session,
&state->parent, &args->symlink);
goto out_free_state;
}