mount: propagate errors back to nfs_mount
nfs41_np.c: NPAddConnection3() was overwriting status=WN_BAD_NETNAME on any errors from DeviceIoControl() nfs41_driver.c: GetConnectionHandle() was only returning the handle, and throwing away the return value from ZwCreateFile() map_mount_errors() was missing a mapping from ERROR_BAD_NET_NAME to STATUS_BAD_NETWORK_NAME Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
a2375b78ac
commit
3d053740c3
2 changed files with 12 additions and 17 deletions
|
|
@ -524,7 +524,6 @@ NPAddConnection3(
|
||||||
NULL, &CopyBytes );
|
NULL, &CopyBytes );
|
||||||
if (Status) {
|
if (Status) {
|
||||||
DbgP(( L"[aglo] SendTo_NFS41Driver failed with %d\n", Status));
|
DbgP(( L"[aglo] SendTo_NFS41Driver failed with %d\n", Status));
|
||||||
Status = WN_BAD_NETNAME;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1845,15 +1845,14 @@ NTSTATUS nfs41_Stop(
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE
|
NTSTATUS
|
||||||
GetConnectionHandle(
|
GetConnectionHandle(
|
||||||
IN PUNICODE_STRING ConnectionName,
|
IN PUNICODE_STRING ConnectionName,
|
||||||
IN PVOID EaBuffer,
|
IN PVOID EaBuffer,
|
||||||
IN ULONG EaLength
|
IN ULONG EaLength,
|
||||||
)
|
OUT PHANDLE Handle)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
HANDLE Handle = INVALID_HANDLE_VALUE;
|
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
|
||||||
|
|
@ -1861,19 +1860,17 @@ GetConnectionHandle(
|
||||||
InitializeObjectAttributes(&ObjectAttributes, ConnectionName,
|
InitializeObjectAttributes(&ObjectAttributes, ConnectionName,
|
||||||
OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE, NULL, NULL);
|
OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE, NULL, NULL);
|
||||||
|
|
||||||
status = ZwCreateFile(&Handle, SYNCHRONIZE, &ObjectAttributes,
|
status = ZwCreateFile(Handle, SYNCHRONIZE, &ObjectAttributes,
|
||||||
&IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL,
|
&IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||||
FILE_OPEN_IF,
|
FILE_OPEN_IF,
|
||||||
FILE_CREATE_TREE_CONNECTION | FILE_SYNCHRONOUS_IO_NONALERT,
|
FILE_CREATE_TREE_CONNECTION | FILE_SYNCHRONOUS_IO_NONALERT,
|
||||||
EaBuffer, EaLength);
|
EaBuffer, EaLength);
|
||||||
if (!NT_SUCCESS(status))
|
if (NT_SUCCESS(status))
|
||||||
Handle = INVALID_HANDLE_VALUE;
|
DbgP("created handle %p\n", Handle);
|
||||||
else
|
|
||||||
DbgP("created handle %p\n", &Handle);
|
|
||||||
|
|
||||||
DbgEx();
|
DbgEx();
|
||||||
return Handle;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS nfs41_GetConnectionInfoFromBuffer(
|
NTSTATUS nfs41_GetConnectionInfoFromBuffer(
|
||||||
|
|
@ -1972,9 +1969,7 @@ nfs41_CreateConnection (
|
||||||
if (status != STATUS_SUCCESS)
|
if (status != STATUS_SUCCESS)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
Handle = GetConnectionHandle(&FileName, EaBuffer, EaLength);
|
status = GetConnectionHandle(&FileName, EaBuffer, EaLength, &Handle);
|
||||||
if (Handle == INVALID_HANDLE_VALUE)
|
|
||||||
status = STATUS_BAD_NETWORK_NAME;
|
|
||||||
out:
|
out:
|
||||||
DbgEx();
|
DbgEx();
|
||||||
return status;
|
return status;
|
||||||
|
|
@ -2062,8 +2057,8 @@ nfs41_DeleteConnection (
|
||||||
FileName.Length = (USHORT) ConnectNameLen - sizeof(WCHAR);
|
FileName.Length = (USHORT) ConnectNameLen - sizeof(WCHAR);
|
||||||
FileName.MaximumLength = (USHORT) ConnectNameLen;
|
FileName.MaximumLength = (USHORT) ConnectNameLen;
|
||||||
|
|
||||||
Handle = GetConnectionHandle(&FileName, NULL, 0);
|
status = GetConnectionHandle(&FileName, NULL, 0, &Handle);
|
||||||
if (Handle == INVALID_HANDLE_VALUE)
|
if (status != STATUS_SUCCESS)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
DbgP("GetConnectionHandle returned success\n");
|
DbgP("GetConnectionHandle returned success\n");
|
||||||
|
|
@ -2352,8 +2347,9 @@ static NTSTATUS map_mount_errors(DWORD status)
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case NO_ERROR: return STATUS_SUCCESS;
|
case NO_ERROR: return STATUS_SUCCESS;
|
||||||
case ERROR_NETWORK_UNREACHABLE:
|
case ERROR_NETWORK_UNREACHABLE: return STATUS_NETWORK_UNREACHABLE;
|
||||||
case ERROR_BAD_NET_RESP: return STATUS_UNEXPECTED_NETWORK_ERROR;
|
case ERROR_BAD_NET_RESP: return STATUS_UNEXPECTED_NETWORK_ERROR;
|
||||||
|
case ERROR_BAD_NET_NAME: return STATUS_BAD_NETWORK_NAME;
|
||||||
case ERROR_BAD_NETPATH: return STATUS_BAD_NETWORK_PATH;
|
case ERROR_BAD_NETPATH: return STATUS_BAD_NETWORK_PATH;
|
||||||
default:
|
default:
|
||||||
print_error("failed to map windows error %d to NTSTATUS; "
|
print_error("failed to map windows error %d to NTSTATUS; "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue