[daemon] moving refcount after version checking

in case of daemon restart, we can't update reference count on session
and open state until we know it's a valid upcall (via version checking)
This commit is contained in:
Olga Kornievskaia 2011-04-27 11:38:40 -04:00
parent dd6f2c1849
commit 0d02adba8e

View file

@ -99,12 +99,8 @@ int upcall_parse(
if (status) goto out; if (status) goto out;
status = safe_read(&buffer, &length, &upcall->root_ref, sizeof(HANDLE)); status = safe_read(&buffer, &length, &upcall->root_ref, sizeof(HANDLE));
if (status) goto out; 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)); status = safe_read(&buffer, &length, &upcall->state_ref, sizeof(HANDLE));
if (status) goto out; 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 session=0x%x open_state=0x%x\n", 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, version, upcall->xid, opcode2string(upcall->opcode), upcall->root_ref,
@ -114,6 +110,10 @@ int upcall_parse(
upcall->status = status = NFSD_VERSION_MISMATCH; upcall->status = status = NFSD_VERSION_MISMATCH;
goto out; goto out;
} }
if (upcall->root_ref != INVALID_HANDLE_VALUE)
nfs41_root_ref(upcall->root_ref);
if (upcall->state_ref != INVALID_HANDLE_VALUE)
nfs41_open_state_ref(upcall->state_ref);
if (upcall->opcode >= g_upcall_op_table_size) { if (upcall->opcode >= g_upcall_op_table_size) {
status = ERROR_NOT_SUPPORTED; status = ERROR_NOT_SUPPORTED;