upcall: set upcall.status on parse failure
when open parsing fails, we were still returning upcall.status==NO_ERROR, so the driver assumed the open succeeded. other operations then sent up an open_state==NULL, and crashed the daemon. when upcall_parse() returns an error, set upcall.status to notify the driver upcall_parse() prints a 'parsing of upcall <name> failed with <error>.' message on failure, so i removed redundant messages from the individual upcall parsing functions Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
a0cda354be
commit
95361423f3
9 changed files with 68 additions and 84 deletions
|
|
@ -69,13 +69,12 @@ int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||||
out:
|
if (status) goto out;
|
||||||
if (status)
|
|
||||||
eprintf("parsing NFS41_FILE_QUERY failed with %d\n", status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS41_FILE_QUERY: info_class=%d buf_len=%d "
|
dprintf(1, "parsing NFS41_FILE_QUERY: info_class=%d buf_len=%d "
|
||||||
"root=0x%p open_state=0x%p\n",
|
"root=0x%p open_state=0x%p\n",
|
||||||
args->query_class, args->buf_len, args->root, args->state);
|
args->query_class, args->buf_len, args->root, args->state);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,14 +104,12 @@ int parse_lock(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->blocking, sizeof(BOOLEAN));
|
status = safe_read(&buffer, &length, &args->blocking, sizeof(BOOLEAN));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
out:
|
|
||||||
if (status)
|
|
||||||
eprintf("parsing NFS41_LOCK failed with %d\n", status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS41_LOCK: state=%p root=%p offset=0x%llx "
|
dprintf(1, "parsing NFS41_LOCK: state=%p root=%p offset=0x%llx "
|
||||||
"length=0x%llx exclusive=%u blocking=%u\n",
|
"length=0x%llx exclusive=%u blocking=%u\n",
|
||||||
args->state, args->root, args->offset, args->length,
|
args->state, args->root, args->offset, args->length,
|
||||||
args->exclusive, args->blocking);
|
args->exclusive, args->blocking);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,12 +194,10 @@ int parse_unlock(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
|
|
||||||
args->buf = buffer;
|
args->buf = buffer;
|
||||||
args->buf_len = length;
|
args->buf_len = length;
|
||||||
out:
|
|
||||||
if (status)
|
|
||||||
eprintf("parsing NFS41_UNLOCK failed with %d\n", status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS41_UNLOCK: state=%p root=%p count=%u\n",
|
dprintf(1, "parsing NFS41_UNLOCK: state=%p root=%p count=%u\n",
|
||||||
args->state, args->root, args->count);
|
args->state, args->root, args->count);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,12 +39,11 @@ int parse_mount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
if(status) goto out;
|
if(status) goto out;
|
||||||
ZeroMemory(&args->path, sizeof(nfs41_abs_path));
|
ZeroMemory(&args->path, sizeof(nfs41_abs_path));
|
||||||
status = get_abs_path(&buffer, &length, &args->path);
|
status = get_abs_path(&buffer, &length, &args->path);
|
||||||
out:
|
if(status) goto out;
|
||||||
if (status)
|
|
||||||
eprintf("parsing of NFS41_MOUNT failed with %d\n", status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS14_MOUNT: srv_name=%s root=%s\n",
|
dprintf(1, "parsing NFS14_MOUNT: srv_name=%s root=%s\n",
|
||||||
args->srv_name, args->path.path);
|
args->srv_name, args->path.path);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,10 +109,10 @@ int parse_unmount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
unmount_upcall_args *args = &upcall->args.unmount;
|
unmount_upcall_args *args = &upcall->args.unmount;
|
||||||
|
|
||||||
status = safe_read(&buffer, &length, &args->root, sizeof(nfs41_session *));
|
status = safe_read(&buffer, &length, &args->root, sizeof(nfs41_session *));
|
||||||
if (status)
|
if (status) goto out;
|
||||||
eprintf("parsing NFS41_UNMOUNT failed with %d\n", status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS41_UNMOUNT: unmount root=%p\n", args->root);
|
dprintf(1, "parsing NFS41_UNMOUNT: unmount root=%p\n", args->root);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,10 @@ static unsigned int WINAPI thread_main(void *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
status = upcall_parse(outbuf, (uint32_t)outbuf_len, &upcall);
|
status = upcall_parse(outbuf, (uint32_t)outbuf_len, &upcall);
|
||||||
if (status)
|
if (status) {
|
||||||
|
upcall.status = status;
|
||||||
goto write_downcall;
|
goto write_downcall;
|
||||||
|
}
|
||||||
|
|
||||||
#if 1 //AGLO: this is just a placeholder for a real solution. I know this variable needs a lock in a
|
#if 1 //AGLO: this is just a placeholder for a real solution. I know this variable needs a lock in a
|
||||||
//normal case. However, this does not prevent us from receiving an upcall for an old mount
|
//normal case. However, this does not prevent us from receiving an upcall for an old mount
|
||||||
|
|
|
||||||
|
|
@ -96,10 +96,8 @@ int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
status = safe_read(&buffer, &length, &args->open_owner_id, sizeof(ULONG));
|
status = safe_read(&buffer, &length, &args->open_owner_id, sizeof(ULONG));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->mode, sizeof(DWORD));
|
status = safe_read(&buffer, &length, &args->mode, sizeof(DWORD));
|
||||||
out:
|
if (status) goto out;
|
||||||
if (status)
|
|
||||||
eprintf("parsing NFS41_OPEN failed with %d\n", status);
|
|
||||||
else {
|
|
||||||
dprintf(1, "parsing NFS41_OPEN: filename='%s' access mask=%d "
|
dprintf(1, "parsing NFS41_OPEN: filename='%s' access mask=%d "
|
||||||
"access mode=%d\n\tfile attrs=0x%x create attrs=0x%x "
|
"access mode=%d\n\tfile attrs=0x%x create attrs=0x%x "
|
||||||
"(kernel) disposition=%d\n\tsession=%p open_owner_id=%d mode=%o\n",
|
"(kernel) disposition=%d\n\tsession=%p open_owner_id=%d mode=%o\n",
|
||||||
|
|
@ -110,7 +108,7 @@ out:
|
||||||
print_access_mask(2, args->access_mask);
|
print_access_mask(2, args->access_mask);
|
||||||
print_share_mode(2, args->access_mode);
|
print_share_mode(2, args->access_mode);
|
||||||
print_create_attributes(2, args->create_opts);
|
print_create_attributes(2, args->create_opts);
|
||||||
}
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -513,15 +511,14 @@ int parse_close(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
status = get_abs_path(&buffer, &length, &args->path);
|
status = get_abs_path(&buffer, &length, &args->path);
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->renamed, sizeof(BOOLEAN));
|
status = safe_read(&buffer, &length, &args->renamed, sizeof(BOOLEAN));
|
||||||
|
if (status) goto out;
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
if (status)
|
|
||||||
eprintf("parsing NFS41_CLOSE failed with %d\n", status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS41_CLOSE: close root=0x%p "
|
dprintf(1, "parsing NFS41_CLOSE: close root=0x%p "
|
||||||
"open_state=0x%p remove=%d renamed=%d filename='%s'\n",
|
"open_state=0x%p remove=%d renamed=%d filename='%s'\n",
|
||||||
args->root, args->state, args->remove, args->renamed,
|
args->root, args->state, args->remove, args->renamed,
|
||||||
args->remove ? args->path.path : "");
|
args->remove ? args->path.path : "");
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,16 +70,13 @@ int parse_readdir(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
dprintf(1, "upcall passing empty cookie\n");
|
dprintf(1, "upcall passing empty cookie\n");
|
||||||
args->cookie = NULL;
|
args->cookie = NULL;
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
if (status)
|
|
||||||
eprintf("parsing NFS41_DIR_QUERY failed with %d\n", status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS41_DIR_QUERY: info_class=%d buf_len=%d "
|
dprintf(1, "parsing NFS41_DIR_QUERY: info_class=%d buf_len=%d "
|
||||||
"filter='%s'\n\tInitial\\Restart\\Single %d\\%d\\%d "
|
"filter='%s'\n\tInitial\\Restart\\Single %d\\%d\\%d "
|
||||||
"root=0x%p state=0x%p cookie=0x%p\n",
|
"root=0x%p state=0x%p cookie=0x%p\n",
|
||||||
args->query_class, args->buf_len, args->filter,
|
args->query_class, args->buf_len, args->filter,
|
||||||
args->initial, args->restart, args->single,
|
args->initial, args->restart, args->single,
|
||||||
args->root, args->state, args->cookie);
|
args->root, args->state, args->cookie);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,14 +47,12 @@ int parse_rw(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
status = safe_read(&buffer, &length, &args->root, sizeof(args->root));
|
status = safe_read(&buffer, &length, &args->root, sizeof(args->root));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||||
out:
|
if (status) goto out;
|
||||||
if (status)
|
|
||||||
eprintf("parsing %s failed with %d\n",
|
|
||||||
opcode2string(upcall->opcode), status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing %s len=%ld offset=%ld buf=%p root=%p "
|
dprintf(1, "parsing %s len=%ld offset=%ld buf=%p root=%p "
|
||||||
"open_state=0x%p\n", opcode2string(upcall->opcode), args->len,
|
"open_state=0x%p\n", opcode2string(upcall->opcode), args->len,
|
||||||
args->offset, args->buffer, args->root, args->state);
|
args->offset, args->buffer, args->root, args->state);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,15 +61,14 @@ int parse_setattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
status = safe_read(&buffer, &length, &args->access_mask, sizeof(ULONG));
|
status = safe_read(&buffer, &length, &args->access_mask, sizeof(ULONG));
|
||||||
if (status) goto out_free;
|
if (status) goto out_free;
|
||||||
status = safe_read(&buffer, &length, &args->access_mode, sizeof(ULONG));
|
status = safe_read(&buffer, &length, &args->access_mode, sizeof(ULONG));
|
||||||
out:
|
if (status) goto out_free;
|
||||||
if (status)
|
|
||||||
eprintf("parsing NFS41_FILE_SET failed with %d\n", status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS41_FILE_SET: filename='%s' info_class=%d "
|
dprintf(1, "parsing NFS41_FILE_SET: filename='%s' info_class=%d "
|
||||||
"buf_len=%d root=%p open_state=%p\nopen_owner_id=%d "
|
"buf_len=%d root=%p open_state=%p\nopen_owner_id=%d "
|
||||||
"access_mask=%x access_mode=%x\n", args->path.path, args->set_class,
|
"access_mask=%x access_mode=%x\n", args->path.path, args->set_class,
|
||||||
args->buf_len, args->root, args->state, args->open_owner_id,
|
args->buf_len, args->root, args->state, args->open_owner_id,
|
||||||
args->access_mask, args->access_mode);
|
args->access_mask, args->access_mode);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
out_free:
|
out_free:
|
||||||
free(args->buf);
|
free(args->buf);
|
||||||
|
|
@ -464,12 +463,11 @@ int parse_setexattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall
|
||||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->mode, sizeof(args->mode));
|
status = safe_read(&buffer, &length, &args->mode, sizeof(args->mode));
|
||||||
out:
|
if (status) goto out;
|
||||||
if (status)
|
|
||||||
eprintf("parsing NFS41_EA_SET failed with %d\n", status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS41_EA_SET: root=%p open_state=%p mode=%o\n",
|
dprintf(1, "parsing NFS41_EA_SET: root=%p open_state=%p mode=%o\n",
|
||||||
args->root, args->state, args->mode);
|
args->root, args->state, args->mode);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,13 +48,11 @@ int parse_volume(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->query, sizeof(FS_INFORMATION_CLASS));
|
status = safe_read(&buffer, &length, &args->query, sizeof(FS_INFORMATION_CLASS));
|
||||||
out:
|
if (status) goto out;
|
||||||
if (status)
|
|
||||||
eprintf("parsing NFS41_VOLUME_QUERY failed with %d\n",
|
|
||||||
status);
|
|
||||||
else
|
|
||||||
dprintf(1, "parsing NFS41_VOLUME_QUERY: root=0x%p, query=%d\n",
|
dprintf(1, "parsing NFS41_VOLUME_QUERY: root=0x%p, query=%d\n",
|
||||||
args->root, args->query);
|
args->root, args->query);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue