symlink: handle_open() detects symlink creation
added check in handle_open() to avoid calling CREATE/OPEN when we're creating a symlink:
if (args->disposition == FILE_CREATE &&
args->access_mask == (FILE_WRITE_ATTRIBUTES | SYNCHRONIZE | DELETE) &&
args->access_mode == 0 &&
args->create_opts & FILE_OPEN_REPARSE_POINT)
these are the open arguments we get from the CreateSymbolicLink() syscall. by avoiding the call to CREATE/OPEN on handle_open(), we save ourselves from having to REMOVE the file before creating the symlink
added a check to handle_symlink() in case the file was actually created on open (an application could open the file with different arguments, and send the FSCTL_SET_REPARSE_POINT manually), and removes the file first
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
62fa6176be
commit
ccdaa169eb
4 changed files with 42 additions and 6 deletions
|
|
@ -188,6 +188,12 @@ int handle_symlink(nfs41_upcall *upcall)
|
|||
int status = NO_ERROR;
|
||||
|
||||
if (args->set) {
|
||||
if (state->file.fh.len) {
|
||||
/* the check in handle_open() didn't catch that we're creating
|
||||
* a symlink, so we have to remove the file it already created */
|
||||
nfs41_remove(state->session, &state->parent, &state->file.name);
|
||||
}
|
||||
|
||||
/* create the symlink */
|
||||
status = nfs41_create(state->session, NF4LNK, 0777,
|
||||
args->target_set, &state->parent, &state->file);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue