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

@ -100,7 +100,8 @@ static int handle_mount(nfs41_upcall *upcall)
goto out_err;
}
args->root = root;
upcall->root_ref = root;
nfs41_root_ref(upcall->root_ref);
out:
return status;
@ -112,10 +113,9 @@ out_err:
static int marshall_mount(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
{
int status;
mount_upcall_args *args = &upcall->args.mount;
dprintf(2, "NFS41_MOUNT: writing pointer to nfs41_root %p and version %d\n",
args->root, NFS41D_VERSION);
status = safe_write(&buffer, length, &args->root, sizeof(args->root));
upcall->root_ref, NFS41D_VERSION);
status = safe_write(&buffer, length, &upcall->root_ref, sizeof(HANDLE));
if (status) goto out;
status = safe_write(&buffer, length, &NFS41D_VERSION, sizeof(DWORD));
out:
@ -124,8 +124,7 @@ out:
static void cancel_mount(IN nfs41_upcall *upcall)
{
mount_upcall_args *args = &upcall->args.mount;
nfs41_root_deref(args->root);
nfs41_root_deref(upcall->root_ref);
}
const nfs41_upcall_op nfs41_op_mount = {
@ -139,24 +138,15 @@ const nfs41_upcall_op nfs41_op_mount = {
/* NFS41_UNMOUNT */
static int parse_unmount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
{
int status;
unmount_upcall_args *args = &upcall->args.unmount;
status = safe_read(&buffer, &length, &args->root, sizeof(nfs41_session *));
if (status) goto out;
dprintf(1, "parsing NFS41_UNMOUNT: unmount root=%p\n", args->root);
out:
return status;
dprintf(1, "parsing NFS41_UNMOUNT: root=%p\n", upcall->root_ref);
return ERROR_SUCCESS;
}
static int handle_unmount(nfs41_upcall *upcall)
{
int status = NO_ERROR;
unmount_upcall_args *args = &upcall->args.unmount;
/* release the original reference from nfs41_root_create() */
nfs41_root_deref(args->root);
return status;
nfs41_root_deref(upcall->root_ref);
return ERROR_SUCCESS;
}
const nfs41_upcall_op nfs41_op_unmount = {