moving session and open_state in upcall header

every upcall (except few) pass session and open_state pointer, so
add that to marshal_nfs41_header() in the driver. remove passing
of session and open_state elsewhere in marshal functions.

in the deamon, upcall.c now reads and stores pointers to session
and open_state in nfs41_upcall datastructure instead of having
each individual upcall store their own pointers. setattrl
and readdir args keeping pointer because the rest of the code
uses them a lot.

in upcall_parse() up refcounts on session and open_state if
valid handles were passed in. down refcounts upcall_cleanup() as
before. but need to be careful with count value for mount and open
upcalls. we need to take an extra ref because upcall_cleanup() now
will always decrement it.
This commit is contained in:
Olga Kornievskaia 2011-04-13 20:07:37 -04:00
parent ea390c1d25
commit 529d7ce6db
13 changed files with 132 additions and 334 deletions

View file

@ -37,17 +37,10 @@ static int parse_getacl(unsigned char *buffer, uint32_t length,
int status;
getacl_upcall_args *args = &upcall->args.getacl;
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
if (status) goto out;
upcall_root_ref(upcall, args->root);
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
if (status) goto out;
upcall_open_state_ref(upcall, args->state);
status = safe_read(&buffer, &length, &args->query, sizeof(args->query));
if (status) goto out;
dprintf(1, "parsing NFS41_ACL_QUERY: info_class=%d root=0x%p "
"open_state=0x%p\n", args->query, args->root, args->state);
dprintf(1, "parsing NFS41_ACL_QUERY: info_class=%d\n", args->query);
out:
return status;
}
@ -273,7 +266,7 @@ static int handle_getacl(nfs41_upcall *upcall)
{
int status = ERROR_NOT_SUPPORTED;
getacl_upcall_args *args = &upcall->args.getacl;
nfs41_open_state *state = args->state;
nfs41_open_state *state = upcall->state_ref;
nfs41_file_info info;
bitmap4 attr_request;
LPSTR domain = NULL;
@ -429,12 +422,6 @@ static int parse_setacl(unsigned char *buffer, uint32_t length,
setacl_upcall_args *args = &upcall->args.setacl;
ULONG sec_desc_len;
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
if (status) goto out;
upcall_root_ref(upcall, args->root);
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
if (status) goto out;
upcall_open_state_ref(upcall, args->state);
status = safe_read(&buffer, &length, &args->query, sizeof(args->query));
if (status) goto out;
status = safe_read(&buffer, &length, &sec_desc_len, sizeof(ULONG));
@ -453,9 +440,8 @@ static int parse_setacl(unsigned char *buffer, uint32_t length,
goto out_free;
} else status = 0;
dprintf(1, "parsing NFS41_ACL_SET: info_class=%d root=0x%p open_state=0x%p"
" sec_desc_len=%d\n", args->query, args->root, args->state,
sec_desc_len);
dprintf(1, "parsing NFS41_ACL_SET: info_class=%d sec_desc_len=%d\n",
args->query, sec_desc_len);
out:
return status;
out_free:
@ -710,7 +696,7 @@ static int handle_setacl(nfs41_upcall *upcall)
{
int status = ERROR_NOT_SUPPORTED;
setacl_upcall_args *args = &upcall->args.setacl;
nfs41_open_state *state = args->state;
nfs41_open_state *state = upcall->state_ref;
nfs41_file_info info;
stateid_arg stateid;
nfsacl41 nfs4_acl;