propagate attrs on dir creation
This commit is contained in:
parent
24781aa472
commit
83cab313f0
4 changed files with 18 additions and 17 deletions
|
|
@ -532,7 +532,8 @@ int nfs41_create(
|
||||||
IN uint32_t mode,
|
IN uint32_t mode,
|
||||||
IN OPTIONAL const char *symlink,
|
IN OPTIONAL const char *symlink,
|
||||||
IN nfs41_path_fh *parent,
|
IN nfs41_path_fh *parent,
|
||||||
OUT nfs41_path_fh *file)
|
OUT nfs41_path_fh *file,
|
||||||
|
OUT nfs41_file_info *info)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
nfs41_compound compound;
|
nfs41_compound compound;
|
||||||
|
|
@ -548,7 +549,7 @@ int nfs41_create(
|
||||||
nfs41_getattr_args getattr_args;
|
nfs41_getattr_args getattr_args;
|
||||||
nfs41_getattr_res getattr_res, pgetattr_res;
|
nfs41_getattr_res getattr_res, pgetattr_res;
|
||||||
bitmap4 attr_request;
|
bitmap4 attr_request;
|
||||||
nfs41_file_info file_info, dir_info;
|
nfs41_file_info dir_info;
|
||||||
nfs41_savefh_res savefh_res;
|
nfs41_savefh_res savefh_res;
|
||||||
nfs41_restorefh_res restorefh_res;
|
nfs41_restorefh_res restorefh_res;
|
||||||
|
|
||||||
|
|
@ -585,7 +586,7 @@ int nfs41_create(
|
||||||
compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
|
compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
|
||||||
getattr_args.attr_request = &attr_request;
|
getattr_args.attr_request = &attr_request;
|
||||||
getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
|
getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
|
||||||
getattr_res.info = &file_info;
|
getattr_res.info = info;
|
||||||
|
|
||||||
compound_add_op(&compound, OP_RESTOREFH, NULL, &restorefh_res);
|
compound_add_op(&compound, OP_RESTOREFH, NULL, &restorefh_res);
|
||||||
|
|
||||||
|
|
@ -602,7 +603,7 @@ int nfs41_create(
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* fill in the file handle's fileid and superblock */
|
/* fill in the file handle's fileid and superblock */
|
||||||
file->fh.fileid = file_info.fileid;
|
file->fh.fileid = info->fileid;
|
||||||
file->fh.superblock = parent->fh.superblock;
|
file->fh.superblock = parent->fh.superblock;
|
||||||
|
|
||||||
/* update the attributes of the parent directory */
|
/* update the attributes of the parent directory */
|
||||||
|
|
@ -612,12 +613,12 @@ int nfs41_create(
|
||||||
parent->fh.fileid, &dir_info);
|
parent->fh.fileid, &dir_info);
|
||||||
|
|
||||||
/* add the new file handle and attributes to the name cache */
|
/* add the new file handle and attributes to the name cache */
|
||||||
memcpy(&file_info.attrmask, &getattr_res.obj_attributes.attrmask,
|
memcpy(&info->attrmask, &getattr_res.obj_attributes.attrmask,
|
||||||
sizeof(bitmap4));
|
sizeof(bitmap4));
|
||||||
AcquireSRWLockShared(&file->path->lock);
|
AcquireSRWLockShared(&file->path->lock);
|
||||||
nfs41_name_cache_insert(session_name_cache(session),
|
nfs41_name_cache_insert(session_name_cache(session),
|
||||||
file->path->path, &file->name, &file->fh,
|
file->path->path, &file->name, &file->fh,
|
||||||
&file_info, &create_res.cinfo, OPEN_DELEGATE_NONE);
|
info, &create_res.cinfo, OPEN_DELEGATE_NONE);
|
||||||
ReleaseSRWLockShared(&file->path->lock);
|
ReleaseSRWLockShared(&file->path->lock);
|
||||||
|
|
||||||
nfs41_superblock_space_changed(file->fh.superblock);
|
nfs41_superblock_space_changed(file->fh.superblock);
|
||||||
|
|
|
||||||
|
|
@ -1057,7 +1057,8 @@ int nfs41_create(
|
||||||
IN uint32_t mode,
|
IN uint32_t mode,
|
||||||
IN OPTIONAL const char *symlink,
|
IN OPTIONAL const char *symlink,
|
||||||
IN nfs41_path_fh *parent,
|
IN nfs41_path_fh *parent,
|
||||||
OUT nfs41_path_fh *file);
|
OUT nfs41_path_fh *file,
|
||||||
|
OUT nfs41_file_info *info);
|
||||||
|
|
||||||
int nfs41_close(
|
int nfs41_close(
|
||||||
IN nfs41_session *session,
|
IN nfs41_session *session,
|
||||||
|
|
|
||||||
|
|
@ -615,21 +615,14 @@ supersede_retry:
|
||||||
|
|
||||||
if (create == OPEN4_CREATE && (args->create_opts & FILE_DIRECTORY_FILE)) {
|
if (create == OPEN4_CREATE && (args->create_opts & FILE_DIRECTORY_FILE)) {
|
||||||
status = nfs41_create(state->session, NF4DIR, args->mode, NULL,
|
status = nfs41_create(state->session, NF4DIR, args->mode, NULL,
|
||||||
&state->parent, &state->file);
|
&state->parent, &state->file, &info);
|
||||||
args->std_info.Directory = 1;
|
|
||||||
args->created = status == NFS4_OK ? TRUE : FALSE;
|
args->created = status == NFS4_OK ? TRUE : FALSE;
|
||||||
} else {
|
} else {
|
||||||
status = open_or_delegate(state, create, createhowmode, args->mode,
|
status = open_or_delegate(state, create, createhowmode, args->mode,
|
||||||
TRUE, &info);
|
TRUE, &info);
|
||||||
if (status == NFS4_OK) {
|
if (status == NFS4_OK && state->delegation.state)
|
||||||
nfs_to_basic_info(&info, &args->basic_info);
|
|
||||||
nfs_to_standard_info(&info, &args->std_info);
|
|
||||||
args->mode = info.mode;
|
|
||||||
args->changeattr = info.change;
|
|
||||||
if (state->delegation.state)
|
|
||||||
args->deleg_type = state->delegation.state->state.type;
|
args->deleg_type = state->delegation.state->state.type;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (status) {
|
if (status) {
|
||||||
dprintf(1, "%s failed with %s\n", (create == OPEN4_CREATE &&
|
dprintf(1, "%s failed with %s\n", (create == OPEN4_CREATE &&
|
||||||
(args->create_opts & FILE_DIRECTORY_FILE))?"nfs41_create":"nfs41_open",
|
(args->create_opts & FILE_DIRECTORY_FILE))?"nfs41_create":"nfs41_open",
|
||||||
|
|
@ -638,6 +631,11 @@ supersede_retry:
|
||||||
goto supersede_retry;
|
goto supersede_retry;
|
||||||
status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND);
|
status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND);
|
||||||
goto out_free_state;
|
goto out_free_state;
|
||||||
|
} else {
|
||||||
|
nfs_to_basic_info(&info, &args->basic_info);
|
||||||
|
nfs_to_standard_info(&info, &args->std_info);
|
||||||
|
args->mode = info.mode;
|
||||||
|
args->changeattr = info.change;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
upcall->state_ref = state;
|
upcall->state_ref = state;
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,7 @@ static int handle_symlink(nfs41_upcall *upcall)
|
||||||
int status = NO_ERROR;
|
int status = NO_ERROR;
|
||||||
|
|
||||||
if (args->set) {
|
if (args->set) {
|
||||||
|
nfs41_file_info info;
|
||||||
/* don't send windows slashes to the server */
|
/* don't send windows slashes to the server */
|
||||||
char *p;
|
char *p;
|
||||||
for (p = args->target_set; *p; p++) if (*p == '\\') *p = '/';
|
for (p = args->target_set; *p; p++) if (*p == '\\') *p = '/';
|
||||||
|
|
@ -241,7 +242,7 @@ static int handle_symlink(nfs41_upcall *upcall)
|
||||||
|
|
||||||
/* create the symlink */
|
/* create the symlink */
|
||||||
status = nfs41_create(state->session, NF4LNK, 0777,
|
status = nfs41_create(state->session, NF4LNK, 0777,
|
||||||
args->target_set, &state->parent, &state->file);
|
args->target_set, &state->parent, &state->file, &info);
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("nfs41_create() for symlink=%s failed with %s\n",
|
eprintf("nfs41_create() for symlink=%s failed with %s\n",
|
||||||
args->target_set, nfs_error_string(status));
|
args->target_set, nfs_error_string(status));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue