hooking up rsize-wsize mount options
after parsing read and write rpc size from the mount command, add the values to mount upcall, then pass these values when creating a CLIENT structure.
This commit is contained in:
parent
5dd3ef1e8c
commit
4c52473527
3 changed files with 33 additions and 16 deletions
|
|
@ -46,9 +46,14 @@ static int parse_mount(unsigned char *buffer, uint32_t length, nfs41_upcall *upc
|
||||||
if(status) goto out;
|
if(status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->sec_flavor, sizeof(DWORD));
|
status = safe_read(&buffer, &length, &args->sec_flavor, sizeof(DWORD));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
|
status = safe_read(&buffer, &length, &args->rsize, sizeof(DWORD));
|
||||||
|
if (status) goto out;
|
||||||
|
status = safe_read(&buffer, &length, &args->wsize, sizeof(DWORD));
|
||||||
|
if (status) goto out;
|
||||||
|
|
||||||
dprintf(1, "parsing NFS14_MOUNT: srv_name=%s root=%s sec_flavor=%s\n",
|
dprintf(1, "parsing NFS14_MOUNT: srv_name=%s root=%s sec_flavor=%s "
|
||||||
args->hostname, args->path, secflavorop2name(args->sec_flavor));
|
"rsize=%d wsize=%d\n", args->hostname, args->path,
|
||||||
|
secflavorop2name(args->sec_flavor), args->rsize, args->wsize);
|
||||||
out:
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -70,8 +75,7 @@ static int handle_mount(nfs41_upcall *upcall)
|
||||||
}
|
}
|
||||||
// create root
|
// create root
|
||||||
status = nfs41_root_create(args->hostname, args->sec_flavor,
|
status = nfs41_root_create(args->hostname, args->sec_flavor,
|
||||||
NFS41_MAX_FILEIO_SIZE + WRITE_OVERHEAD,
|
args->wsize + WRITE_OVERHEAD, args->rsize + READ_OVERHEAD, &root);
|
||||||
NFS41_MAX_FILEIO_SIZE + READ_OVERHEAD, &root);
|
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("nfs41_root_create() failed %d\n", status);
|
eprintf("nfs41_root_create() failed %d\n", status);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ typedef struct __mount_upcall_args {
|
||||||
const char *hostname;
|
const char *hostname;
|
||||||
const char *path;
|
const char *path;
|
||||||
DWORD sec_flavor;
|
DWORD sec_flavor;
|
||||||
|
DWORD rsize;
|
||||||
|
DWORD wsize;
|
||||||
} mount_upcall_args;
|
} mount_upcall_args;
|
||||||
|
|
||||||
typedef struct __open_upcall_args {
|
typedef struct __open_upcall_args {
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,8 @@ typedef struct _updowncall_entry {
|
||||||
PUNICODE_STRING srv_name;
|
PUNICODE_STRING srv_name;
|
||||||
PUNICODE_STRING root;
|
PUNICODE_STRING root;
|
||||||
DWORD sec_flavor;
|
DWORD sec_flavor;
|
||||||
|
DWORD rsize;
|
||||||
|
DWORD wsize;
|
||||||
} Mount;
|
} Mount;
|
||||||
struct {
|
struct {
|
||||||
PMDL MdlAddress;
|
PMDL MdlAddress;
|
||||||
|
|
@ -307,8 +309,8 @@ DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5P_NAME, L"krb5p");
|
||||||
#define SERVER_NAME_BUFFER_SIZE 1024
|
#define SERVER_NAME_BUFFER_SIZE 1024
|
||||||
|
|
||||||
#define MOUNT_CONFIG_RW_SIZE_MIN 1024
|
#define MOUNT_CONFIG_RW_SIZE_MIN 1024
|
||||||
#define MOUNT_CONFIG_RW_SIZE_DEFAULT 32768
|
#define MOUNT_CONFIG_RW_SIZE_DEFAULT 1048576
|
||||||
#define MOUNT_CONFIG_RW_SIZE_MAX 65536
|
#define MOUNT_CONFIG_RW_SIZE_MAX 1048576
|
||||||
#define MAX_SEC_FLAVOR_LEN 12
|
#define MAX_SEC_FLAVOR_LEN 12
|
||||||
|
|
||||||
typedef struct _NFS41_MOUNT_CONFIG {
|
typedef struct _NFS41_MOUNT_CONFIG {
|
||||||
|
|
@ -569,7 +571,7 @@ NTSTATUS marshal_nfs41_mount(nfs41_updowncall_entry *entry,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
header_len = *len + length_as_ansi(entry->u.Mount.srv_name) +
|
header_len = *len + length_as_ansi(entry->u.Mount.srv_name) +
|
||||||
length_as_ansi(entry->u.Mount.root) + sizeof(entry->u.Mount.sec_flavor);
|
length_as_ansi(entry->u.Mount.root) + 3 * sizeof(DWORD);
|
||||||
if (header_len > buf_len) {
|
if (header_len > buf_len) {
|
||||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -578,13 +580,18 @@ NTSTATUS marshal_nfs41_mount(nfs41_updowncall_entry *entry,
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = marshall_unicode_as_ansi(&tmp, entry->u.Mount.root);
|
status = marshall_unicode_as_ansi(&tmp, entry->u.Mount.root);
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
RtlCopyMemory(tmp, &entry->u.Mount.sec_flavor, sizeof(entry->u.Mount.sec_flavor));
|
RtlCopyMemory(tmp, &entry->u.Mount.sec_flavor, sizeof(DWORD));
|
||||||
|
tmp += sizeof(DWORD);
|
||||||
|
RtlCopyMemory(tmp, &entry->u.Mount.rsize, sizeof(DWORD));
|
||||||
|
tmp += sizeof(DWORD);
|
||||||
|
RtlCopyMemory(tmp, &entry->u.Mount.wsize, sizeof(DWORD));
|
||||||
|
|
||||||
*len = header_len;
|
*len = header_len;
|
||||||
|
|
||||||
DbgP("marshal_nfs41_mount: server name=%wZ mount point=%wZ sec_flavor=%s\n",
|
DbgP("marshal_nfs41_mount: server name=%wZ mount point=%wZ sec_flavor=%s"
|
||||||
entry->u.Mount.srv_name, entry->u.Mount.root,
|
"rsize=%d wsize=%d\n", entry->u.Mount.srv_name, entry->u.Mount.root,
|
||||||
secflavorop2name(entry->u.Mount.sec_flavor));
|
secflavorop2name(entry->u.Mount.sec_flavor), entry->u.Mount.rsize,
|
||||||
|
entry->u.Mount.wsize);
|
||||||
out:
|
out:
|
||||||
DbgEx();
|
DbgEx();
|
||||||
return status;
|
return status;
|
||||||
|
|
@ -2354,8 +2361,8 @@ static NTSTATUS map_mount_errors(DWORD status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS nfs41_mount(PUNICODE_STRING srv_name, PUNICODE_STRING root,
|
NTSTATUS nfs41_mount(PNFS41_MOUNT_CONFIG config, DWORD sec_flavor,
|
||||||
DWORD sec_flavor, PHANDLE session, DWORD *version)
|
PHANDLE session, DWORD *version)
|
||||||
{
|
{
|
||||||
NTSTATUS status = STATUS_INSUFFICIENT_RESOURCES;
|
NTSTATUS status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
nfs41_updowncall_entry *entry;
|
nfs41_updowncall_entry *entry;
|
||||||
|
|
@ -2365,8 +2372,10 @@ NTSTATUS nfs41_mount(PUNICODE_STRING srv_name, PUNICODE_STRING root,
|
||||||
INVALID_HANDLE_VALUE, *version, &entry);
|
INVALID_HANDLE_VALUE, *version, &entry);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
entry->u.Mount.srv_name = srv_name;
|
entry->u.Mount.srv_name = &config->SrvName;
|
||||||
entry->u.Mount.root = root;
|
entry->u.Mount.root = &config->MntPt;
|
||||||
|
entry->u.Mount.rsize = config->ReadSize;
|
||||||
|
entry->u.Mount.wsize = config->WriteSize;
|
||||||
entry->u.Mount.sec_flavor = sec_flavor;
|
entry->u.Mount.sec_flavor = sec_flavor;
|
||||||
|
|
||||||
if (nfs41_UpcallWaitForReply(entry) != STATUS_SUCCESS) {
|
if (nfs41_UpcallWaitForReply(entry) != STATUS_SUCCESS) {
|
||||||
|
|
@ -2442,11 +2451,13 @@ static NTSTATUS nfs41_MountConfig_ParseDword(
|
||||||
status = RtlUnicodeStringToInteger(usValue, 0, Value);
|
status = RtlUnicodeStringToInteger(usValue, 0, Value);
|
||||||
if (status == STATUS_SUCCESS)
|
if (status == STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
|
#ifdef IMPOSE_MINMAX_RWSIZES
|
||||||
if (*Value < Minimum)
|
if (*Value < Minimum)
|
||||||
*Value = Minimum;
|
*Value = Minimum;
|
||||||
if (*Value > Maximum)
|
if (*Value > Maximum)
|
||||||
*Value = Maximum;
|
*Value = Maximum;
|
||||||
DbgP(" '%ls' -> '%wZ' -> %lu\n", Name, *usValue, *Value);
|
DbgP(" '%ls' -> '%wZ' -> %lu\n", Name, *usValue, *Value);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
print_error("Failed to convert %s='%wZ' to unsigned long.\n",
|
print_error("Failed to convert %s='%wZ' to unsigned long.\n",
|
||||||
|
|
@ -2743,7 +2754,7 @@ NTSTATUS nfs41_CreateVNetRoot(
|
||||||
/* send the mount upcall */
|
/* send the mount upcall */
|
||||||
DbgP("Server Name %wZ Mount Point %wZ SecFlavor %wZ\n",
|
DbgP("Server Name %wZ Mount Point %wZ SecFlavor %wZ\n",
|
||||||
&Config.SrvName, &Config.MntPt, &Config.SecFlavor);
|
&Config.SrvName, &Config.MntPt, &Config.SecFlavor);
|
||||||
status = nfs41_mount(&Config.SrvName, &Config.MntPt, pVNetRootContext->sec_flavor,
|
status = nfs41_mount(&Config, pVNetRootContext->sec_flavor,
|
||||||
&pVNetRootContext->session, &nfs41d_version);
|
&pVNetRootContext->session, &nfs41d_version);
|
||||||
if (status != STATUS_SUCCESS) {
|
if (status != STATUS_SUCCESS) {
|
||||||
if (!found_existing_mount) {
|
if (!found_existing_mount) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue