volume: use actual fh instead of rootfh for volume queries
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
db5983734d
commit
e3c67c0bfa
3 changed files with 16 additions and 5 deletions
|
|
@ -145,6 +145,7 @@ typedef struct __symlink_upcall_args {
|
||||||
|
|
||||||
typedef struct __volume_upcall_args {
|
typedef struct __volume_upcall_args {
|
||||||
nfs41_root *root;
|
nfs41_root *root;
|
||||||
|
nfs41_open_state *state;
|
||||||
FS_INFORMATION_CLASS query;
|
FS_INFORMATION_CLASS query;
|
||||||
int len;
|
int len;
|
||||||
union {
|
union {
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ static int parse_volume(unsigned char *buffer, uint32_t length, nfs41_upcall *up
|
||||||
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;
|
||||||
upcall_root_ref(upcall, args->root);
|
upcall_root_ref(upcall, args->root);
|
||||||
|
status = safe_read(&buffer, &length, &args->state, sizeof(HANDLE));
|
||||||
|
if (status) goto out;
|
||||||
|
upcall_open_state_ref(upcall, args->state);
|
||||||
status = safe_read(&buffer, &length, &args->query, sizeof(FS_INFORMATION_CLASS));
|
status = safe_read(&buffer, &length, &args->query, sizeof(FS_INFORMATION_CLASS));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
|
|
||||||
|
|
@ -60,6 +63,7 @@ out:
|
||||||
|
|
||||||
static int get_volume_size_info(
|
static int get_volume_size_info(
|
||||||
IN nfs41_session *session,
|
IN nfs41_session *session,
|
||||||
|
IN nfs41_open_state *state,
|
||||||
IN const char *query,
|
IN const char *query,
|
||||||
OUT OPTIONAL PLONGLONG total_out,
|
OUT OPTIONAL PLONGLONG total_out,
|
||||||
OUT OPTIONAL PLONGLONG user_out,
|
OUT OPTIONAL PLONGLONG user_out,
|
||||||
|
|
@ -71,7 +75,7 @@ static int get_volume_size_info(
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* query the space_ attributes of the root filesystem */
|
/* query the space_ attributes of the root filesystem */
|
||||||
status = nfs41_getattr(session, NULL, &attr_request, &info);
|
status = nfs41_getattr(session, &state->file, &attr_request, &info);
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("nfs41_getattr() failed with %s\n",
|
eprintf("nfs41_getattr() failed with %s\n",
|
||||||
nfs_error_string(status));
|
nfs_error_string(status));
|
||||||
|
|
@ -101,7 +105,7 @@ static int handle_volume_attributes(
|
||||||
PFILE_FS_ATTRIBUTE_INFORMATION attr = &args->info.attribute;
|
PFILE_FS_ATTRIBUTE_INFORMATION attr = &args->info.attribute;
|
||||||
int status = NO_ERROR;
|
int status = NO_ERROR;
|
||||||
|
|
||||||
status = nfs41_getattr(session, NULL, &attr_request, &info);
|
status = nfs41_getattr(session, &args->state->file, &attr_request, &info);
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("nfs41_getattr() failed with %s\n",
|
eprintf("nfs41_getattr() failed with %s\n",
|
||||||
nfs_error_string(status));
|
nfs_error_string(status));
|
||||||
|
|
@ -145,7 +149,8 @@ static int handle_volume(nfs41_upcall *upcall)
|
||||||
args->info.size.SectorsPerAllocationUnit = SECTORS_PER_UNIT;
|
args->info.size.SectorsPerAllocationUnit = SECTORS_PER_UNIT;
|
||||||
args->info.size.BytesPerSector = BYTES_PER_SECTOR;
|
args->info.size.BytesPerSector = BYTES_PER_SECTOR;
|
||||||
|
|
||||||
status = get_volume_size_info(session, "FileFsSizeInformation",
|
status = get_volume_size_info(session, args->state,
|
||||||
|
"FileFsSizeInformation",
|
||||||
&args->info.size.TotalAllocationUnits.QuadPart,
|
&args->info.size.TotalAllocationUnits.QuadPart,
|
||||||
&args->info.size.AvailableAllocationUnits.QuadPart,
|
&args->info.size.AvailableAllocationUnits.QuadPart,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
@ -156,7 +161,8 @@ static int handle_volume(nfs41_upcall *upcall)
|
||||||
args->info.fullsize.SectorsPerAllocationUnit = SECTORS_PER_UNIT;
|
args->info.fullsize.SectorsPerAllocationUnit = SECTORS_PER_UNIT;
|
||||||
args->info.fullsize.BytesPerSector = BYTES_PER_SECTOR;
|
args->info.fullsize.BytesPerSector = BYTES_PER_SECTOR;
|
||||||
|
|
||||||
status = get_volume_size_info(session, "FileFsFullSizeInformation",
|
status = get_volume_size_info(session, args->state,
|
||||||
|
"FileFsFullSizeInformation",
|
||||||
&args->info.fullsize.TotalAllocationUnits.QuadPart,
|
&args->info.fullsize.TotalAllocationUnits.QuadPart,
|
||||||
&args->info.fullsize.CallerAvailableAllocationUnits.QuadPart,
|
&args->info.fullsize.CallerAvailableAllocationUnits.QuadPart,
|
||||||
&args->info.fullsize.ActualAvailableAllocationUnits.QuadPart);
|
&args->info.fullsize.ActualAvailableAllocationUnits.QuadPart);
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,7 @@ typedef struct _updowncall_entry {
|
||||||
BOOLEAN set;
|
BOOLEAN set;
|
||||||
} Symlink;
|
} Symlink;
|
||||||
struct {
|
struct {
|
||||||
|
HANDLE open_state;
|
||||||
HANDLE session;
|
HANDLE session;
|
||||||
FS_INFORMATION_CLASS query;
|
FS_INFORMATION_CLASS query;
|
||||||
PVOID buf;
|
PVOID buf;
|
||||||
|
|
@ -1068,7 +1069,7 @@ NTSTATUS marshal_nfs41_volume(nfs41_updowncall_entry *entry,
|
||||||
goto out;
|
goto out;
|
||||||
else
|
else
|
||||||
tmp += *len;
|
tmp += *len;
|
||||||
header_len = *len + sizeof(HANDLE) + sizeof(FS_INFORMATION_CLASS);
|
header_len = *len + 2 * sizeof(HANDLE) + sizeof(FS_INFORMATION_CLASS);
|
||||||
if (header_len > buf_len) {
|
if (header_len > buf_len) {
|
||||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -1076,6 +1077,8 @@ NTSTATUS marshal_nfs41_volume(nfs41_updowncall_entry *entry,
|
||||||
|
|
||||||
RtlCopyMemory(tmp, &entry->u.Volume.session, sizeof(HANDLE));
|
RtlCopyMemory(tmp, &entry->u.Volume.session, sizeof(HANDLE));
|
||||||
tmp += sizeof(HANDLE);
|
tmp += sizeof(HANDLE);
|
||||||
|
RtlCopyMemory(tmp, &entry->u.Volume.open_state, sizeof(HANDLE));
|
||||||
|
tmp += sizeof(HANDLE);
|
||||||
RtlCopyMemory(tmp, &entry->u.Volume.query, sizeof(FS_INFORMATION_CLASS));
|
RtlCopyMemory(tmp, &entry->u.Volume.query, sizeof(FS_INFORMATION_CLASS));
|
||||||
*len = header_len;
|
*len = header_len;
|
||||||
|
|
||||||
|
|
@ -3381,6 +3384,7 @@ NTSTATUS nfs41_QueryVolumeInformation (
|
||||||
status = nfs41_UpcallCreate(NFS41_VOLUME_QUERY, &nfs41_fobx->sec_ctx, &entry);
|
status = nfs41_UpcallCreate(NFS41_VOLUME_QUERY, &nfs41_fobx->sec_ctx, &entry);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
|
entry->u.Volume.open_state = nfs41_fobx->nfs41_open_state;
|
||||||
entry->u.Volume.session = pVNetRootContext->session;
|
entry->u.Volume.session = pVNetRootContext->session;
|
||||||
entry->u.Volume.query = InfoClass;
|
entry->u.Volume.query = InfoClass;
|
||||||
entry->u.Volume.buf = RxContext->Info.Buffer;
|
entry->u.Volume.buf = RxContext->Info.Buffer;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue