adding version to the upcall

to determine that the daemon has restarted -- rather that daemon is receiving upcalls from the kernel that were processed by the old instance of the daemon -- add a version to the upcall mechanism.

when daemon starts up it generates a version number (just a timestamp). it passes this value to the driver on start up via "start_ioctl" downcall. the driver saves that value in its device extensions. it uses that value in the mount and shtudown upcalls.

when daemon replies to the mount command it again sends its version as a part of the reply. this reply is stored in driver;s netroot extensions. the driver uses netroot's value in each upcall to the daemon.

if the daemon receives an upcall for an operation where the included version does not equal to the its current version, it fails the upcall (error_code=116).

a restart of the daemon would change driver's device extension value which the driver will then use in the new mount upcalls that would establish new sessions. then the correct daemon version would be returned as a part of the mount downcalled and saved in the netroot.
This commit is contained in:
Olga Kornievskaia 2010-11-05 20:08:55 -04:00 committed by unknown
parent 765fb43156
commit a25a5221d9
7 changed files with 101 additions and 35 deletions

View file

@ -72,6 +72,7 @@ int upcall_parse(
{
int status;
const nfs41_upcall_op *op;
DWORD version;
ZeroMemory(upcall, sizeof(nfs41_upcall));
if (!length) {
@ -84,12 +85,20 @@ int upcall_parse(
print_hexbuf(4, (unsigned char *)"upcall buffer: ", buffer, length);
/* parse common elements */
status = safe_read(&buffer, &length, &version, sizeof(uint32_t));
if (status) goto out;
status = safe_read(&buffer, &length, &upcall->xid, sizeof(uint32_t));
if (status) goto out;
status = safe_read(&buffer, &length, &upcall->opcode, sizeof(uint32_t));
if (status) goto out;
dprintf(2, "xid=%d opcode=%s\n", upcall->xid, opcode2string(upcall->opcode));
dprintf(2, "version=%d xid=%d opcode=%s\n", version, upcall->xid,
opcode2string(upcall->opcode));
if (version != NFS41D_VERSION) {
eprintf("received version %d expecting version %d\n", version, NFS41D_VERSION);
upcall->status = status = 116;
goto out;
}
if (upcall->opcode >= g_upcall_op_table_size) {
status = ERROR_NOT_SUPPORTED;