volume: cache volume attributes on mount

struct NFS41_V_NET_ROOT_EXTENSION now stores only the FILE_FS_ATTRIBUTE_INFORMATION (without the extra buffer space for a name).  on QueryVolumeInfo() for FileFsAttributeInformation on the root directory, the FILE_FS_ATTRIBUTE_INFORMATION is copied into the output buffer, and the name is added there.  QueryVolumeInfo() only makes upcalls when FileFsAttributeInformation queries are not for the root directory

new function is_root_directory() uses the logic from Set/GetReparsePoint() to determine whether it's operating on the root directory

moved logic from volume.c:handle_volume_attributes() to superblock.c:nfs41_superblock_fs_attributes().  the mount downcall copies the FILE_FS_ATTRIBUTE_INFORMATION buffer down to the driver.  the driver reads this buffer directly into VNetRootContext->FsAttrs

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2012-04-10 12:05:43 -04:00 committed by unknown
parent 4c8c263b49
commit 2baeeb855b
6 changed files with 94 additions and 78 deletions

View file

@ -61,6 +61,7 @@ static int handle_mount(nfs41_upcall *upcall)
multi_addr4 addrs;
nfs41_root *root;
nfs41_client *client;
nfs41_path_fh file;
// resolve hostname,port
status = nfs41_server_resolve(args->hostname, 2049, &addrs);
@ -95,13 +96,15 @@ static int handle_mount(nfs41_upcall *upcall)
// look up the mount path, and fail if it doesn't exist
status = nfs41_lookup(root, client->session,
&path, NULL, NULL, NULL, NULL);
&path, NULL, &file, NULL, NULL);
if (status) {
eprintf("nfs41_lookup('%s') failed with %d\n", path.path, status);
status = ERROR_BAD_NETPATH;
goto out_err;
}
nfs41_superblock_fs_attributes(file.fh.superblock, &args->FsAttrs);
upcall->root_ref = root;
nfs41_root_ref(upcall->root_ref);
args->lease_time = client->session->lease_time;
@ -124,6 +127,8 @@ static int marshall_mount(unsigned char *buffer, uint32_t *length, nfs41_upcall
status = safe_write(&buffer, length, &NFS41D_VERSION, sizeof(DWORD));
if (status) goto out;
status = safe_write(&buffer, length, &args->lease_time, sizeof(DWORD));
if (status) goto out;
status = safe_write(&buffer, length, &args->FsAttrs, sizeof(args->FsAttrs));
out:
return status;
}