max_path: make an abs_path for lookup on mount
in handle_mount(), the call to nfs41_lookup() requires a mutable nfs41_abs_path because it can change on referrals, so make a copy for it removed unused fields in struct nfs41_root and related arguments to nfs41_root_create() Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
f727a1e4b4
commit
6d2b631080
3 changed files with 16 additions and 16 deletions
|
|
@ -22,6 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include <strsafe.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "daemon_debug.h"
|
#include "daemon_debug.h"
|
||||||
|
|
@ -50,20 +51,19 @@ int handle_mount(nfs41_upcall *upcall)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
mount_upcall_args *args = &upcall->args.mount;
|
mount_upcall_args *args = &upcall->args.mount;
|
||||||
|
nfs41_abs_path path;
|
||||||
multi_addr4 addrs;
|
multi_addr4 addrs;
|
||||||
const unsigned short port = 2049;
|
|
||||||
nfs41_root *root;
|
nfs41_root *root;
|
||||||
nfs41_client *client;
|
nfs41_client *client;
|
||||||
|
|
||||||
// resolve hostname,port
|
// resolve hostname,port
|
||||||
status = nfs41_server_resolve(args->hostname, port, &addrs);
|
status = nfs41_server_resolve(args->hostname, 2049, &addrs);
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("nfs41_server_resolve() failed with %d\n", status);
|
eprintf("nfs41_server_resolve() failed with %d\n", status);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
// create root
|
// create root
|
||||||
status = nfs41_root_create(args->hostname, port, &args->path,
|
status = nfs41_root_create(NFS41_MAX_FILEIO_SIZE + WRITE_OVERHEAD,
|
||||||
NFS41_MAX_FILEIO_SIZE + WRITE_OVERHEAD,
|
|
||||||
NFS41_MAX_FILEIO_SIZE + READ_OVERHEAD, &root);
|
NFS41_MAX_FILEIO_SIZE + READ_OVERHEAD, &root);
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("nfs41_rpc_clnt_create failed %d\n", status);
|
eprintf("nfs41_rpc_clnt_create failed %d\n", status);
|
||||||
|
|
@ -75,12 +75,21 @@ int handle_mount(nfs41_upcall *upcall)
|
||||||
eprintf("nfs41_root_mount() failed with %d\n", status);
|
eprintf("nfs41_root_mount() failed with %d\n", status);
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make a copy of the path for nfs41_lookup()
|
||||||
|
InitializeSRWLock(&path.lock);
|
||||||
|
if (FAILED(StringCchCopyA(path.path, NFS41_MAX_PATH_LEN, args->path))) {
|
||||||
|
status = ERROR_BUFFER_OVERFLOW;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
path.len = (unsigned short)strlen(path.path);
|
||||||
|
|
||||||
// look up the mount path, and fail if it doesn't exist
|
// look up the mount path, and fail if it doesn't exist
|
||||||
status = nfs41_lookup(root, client->session,
|
status = nfs41_lookup(root, client->session,
|
||||||
&args->path, NULL, NULL, NULL, NULL);
|
&path, NULL, NULL, NULL, NULL);
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("nfs41_lookup('%s') failed with %d\n",
|
eprintf("nfs41_lookup('%s') failed with %d\n",
|
||||||
args->path.path, status);
|
path.path, status);
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,6 @@
|
||||||
|
|
||||||
/* nfs41_root */
|
/* nfs41_root */
|
||||||
int nfs41_root_create(
|
int nfs41_root_create(
|
||||||
IN const char *hostname,
|
|
||||||
IN unsigned short port,
|
|
||||||
IN const nfs41_abs_path *path,
|
|
||||||
IN uint32_t wsize,
|
IN uint32_t wsize,
|
||||||
IN uint32_t rsize,
|
IN uint32_t rsize,
|
||||||
OUT nfs41_root **root_out)
|
OUT nfs41_root **root_out)
|
||||||
|
|
@ -47,8 +44,7 @@ int nfs41_root_create(
|
||||||
int status = NO_ERROR;
|
int status = NO_ERROR;
|
||||||
nfs41_root *root;
|
nfs41_root *root;
|
||||||
|
|
||||||
dprintf(NSLVL, "--> nfs41_root_create(%s:%u:%s)\n",
|
dprintf(NSLVL, "--> nfs41_root_create()\n");
|
||||||
hostname, port, path);
|
|
||||||
|
|
||||||
root = calloc(1, sizeof(nfs41_root));
|
root = calloc(1, sizeof(nfs41_root));
|
||||||
if (root == NULL) {
|
if (root == NULL) {
|
||||||
|
|
@ -57,7 +53,6 @@ int nfs41_root_create(
|
||||||
}
|
}
|
||||||
|
|
||||||
list_init(&root->clients);
|
list_init(&root->clients);
|
||||||
root->port = port;
|
|
||||||
root->wsize = wsize;
|
root->wsize = wsize;
|
||||||
root->rsize = rsize;
|
root->rsize = rsize;
|
||||||
InitializeCriticalSection(&root->lock);
|
InitializeCriticalSection(&root->lock);
|
||||||
|
|
|
||||||
|
|
@ -166,15 +166,11 @@ typedef struct __nfs41_root {
|
||||||
struct list_entry clients;
|
struct list_entry clients;
|
||||||
uint32_t wsize;
|
uint32_t wsize;
|
||||||
uint32_t rsize;
|
uint32_t rsize;
|
||||||
unsigned short port;
|
|
||||||
} nfs41_root;
|
} nfs41_root;
|
||||||
|
|
||||||
|
|
||||||
/* nfs41_namespace.c */
|
/* nfs41_namespace.c */
|
||||||
int nfs41_root_create(
|
int nfs41_root_create(
|
||||||
IN const char *hostname,
|
|
||||||
IN unsigned short port,
|
|
||||||
IN const char *path,
|
|
||||||
IN uint32_t wsize,
|
IN uint32_t wsize,
|
||||||
IN uint32_t rsize,
|
IN uint32_t rsize,
|
||||||
OUT nfs41_root **root_out);
|
OUT nfs41_root **root_out);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue