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:
parent
ea390c1d25
commit
529d7ce6db
13 changed files with 132 additions and 334 deletions
|
|
@ -97,9 +97,18 @@ int upcall_parse(
|
|||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &upcall->opcode, sizeof(uint32_t));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &upcall->root_ref, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
if (upcall->root_ref != INVALID_HANDLE_VALUE)
|
||||
nfs41_root_ref(upcall->root_ref);
|
||||
status = safe_read(&buffer, &length, &upcall->state_ref, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
if (upcall->state_ref != INVALID_HANDLE_VALUE)
|
||||
nfs41_open_state_ref(upcall->state_ref);
|
||||
|
||||
dprintf(2, "version=%d xid=%d opcode=%s\n", version, upcall->xid,
|
||||
opcode2string(upcall->opcode));
|
||||
dprintf(2, "version=%d xid=%d opcode=%s session=0x%x open_state=0x%x\n",
|
||||
version, upcall->xid, opcode2string(upcall->opcode), upcall->root_ref,
|
||||
upcall->state_ref);
|
||||
if (version != NFS41D_VERSION) {
|
||||
eprintf("received version %d expecting version %d\n", version, NFS41D_VERSION);
|
||||
upcall->status = status = NFSD_VERSION_MISMATCH;
|
||||
|
|
@ -196,11 +205,11 @@ void upcall_cleanup(
|
|||
if (op && op->cleanup && upcall->status != NFSD_VERSION_MISMATCH)
|
||||
op->cleanup(upcall);
|
||||
|
||||
if (upcall->state_ref) {
|
||||
if (upcall->state_ref && upcall->state_ref != INVALID_HANDLE_VALUE) {
|
||||
nfs41_open_state_deref(upcall->state_ref);
|
||||
upcall->state_ref = NULL;
|
||||
}
|
||||
if (upcall->root_ref) {
|
||||
if (upcall->root_ref && upcall->root_ref != INVALID_HANDLE_VALUE) {
|
||||
nfs41_root_deref(upcall->root_ref);
|
||||
upcall->root_ref = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue