[driver] using InterlockedIncrement for open_owner_id
This commit is contained in:
parent
9efa410e5a
commit
62dfd87bda
3 changed files with 7 additions and 16 deletions
|
|
@ -266,7 +266,7 @@ static int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upca
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->disposition, sizeof(ULONG));
|
status = safe_read(&buffer, &length, &args->disposition, sizeof(ULONG));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->open_owner_id, sizeof(ULONG));
|
status = safe_read(&buffer, &length, &args->open_owner_id, sizeof(LONG));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
status = safe_read(&buffer, &length, &args->mode, sizeof(DWORD));
|
status = safe_read(&buffer, &length, &args->mode, sizeof(DWORD));
|
||||||
if (status) goto out;
|
if (status) goto out;
|
||||||
|
|
@ -428,7 +428,7 @@ static int handle_open(nfs41_upcall *upcall)
|
||||||
|
|
||||||
status = create_open_state(args->path, args->open_owner_id, &state);
|
status = create_open_state(args->path, args->open_owner_id, &state);
|
||||||
if (status) {
|
if (status) {
|
||||||
eprintf("create_open_state(%u) failed with %d\n",
|
eprintf("create_open_state(%d) failed with %d\n",
|
||||||
args->open_owner_id, status);
|
args->open_owner_id, status);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ typedef struct __open_upcall_args {
|
||||||
ULONG file_attrs;
|
ULONG file_attrs;
|
||||||
ULONG disposition;
|
ULONG disposition;
|
||||||
ULONG create_opts;
|
ULONG create_opts;
|
||||||
ULONG open_owner_id;
|
LONG open_owner_id;
|
||||||
DWORD mode;
|
DWORD mode;
|
||||||
LONGLONG changeattr;
|
LONGLONG changeattr;
|
||||||
BOOLEAN created;
|
BOOLEAN created;
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ FAST_MUTEX xidLock;
|
||||||
FAST_MUTEX openOwnerLock;
|
FAST_MUTEX openOwnerLock;
|
||||||
|
|
||||||
LONGLONG xid = 0;
|
LONGLONG xid = 0;
|
||||||
ULONG open_owner_id = 1;
|
LONG open_owner_id = 1;
|
||||||
|
|
||||||
#define DECLARE_CONST_ANSI_STRING(_var, _string) \
|
#define DECLARE_CONST_ANSI_STRING(_var, _string) \
|
||||||
const CHAR _var ## _buffer[] = _string; \
|
const CHAR _var ## _buffer[] = _string; \
|
||||||
|
|
@ -171,7 +171,7 @@ typedef struct _updowncall_entry {
|
||||||
ULONG copts;
|
ULONG copts;
|
||||||
ULONG disp;
|
ULONG disp;
|
||||||
ULONG cattrs;
|
ULONG cattrs;
|
||||||
ULONG open_owner_id;
|
LONG open_owner_id;
|
||||||
DWORD mode;
|
DWORD mode;
|
||||||
LONGLONG changeattr;
|
LONGLONG changeattr;
|
||||||
BOOLEAN symlink_embedded;
|
BOOLEAN symlink_embedded;
|
||||||
|
|
@ -420,15 +420,6 @@ nfs41_start_driver_state nfs41_start_state = NFS41_START_DRIVER_STARTABLE;
|
||||||
|
|
||||||
NTSTATUS map_readwrite_errors(DWORD status);
|
NTSTATUS map_readwrite_errors(DWORD status);
|
||||||
|
|
||||||
ULONG get_next_open_owner()
|
|
||||||
{
|
|
||||||
ULONG x;
|
|
||||||
ExAcquireFastMutex(&openOwnerLock);
|
|
||||||
x = open_owner_id++;
|
|
||||||
ExReleaseFastMutex(&openOwnerLock);
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_debug_header(
|
void print_debug_header(
|
||||||
PRX_CONTEXT RxContext)
|
PRX_CONTEXT RxContext)
|
||||||
{
|
{
|
||||||
|
|
@ -617,7 +608,7 @@ NTSTATUS marshal_nfs41_open(
|
||||||
else
|
else
|
||||||
tmp += *len;
|
tmp += *len;
|
||||||
header_len = *len + length_as_ansi(entry->u.Open.filename) +
|
header_len = *len + length_as_ansi(entry->u.Open.filename) +
|
||||||
6 * sizeof(ULONG) + sizeof(DWORD);
|
5 * sizeof(ULONG) + sizeof(LONG) + sizeof(DWORD);
|
||||||
if (header_len > buf_len) {
|
if (header_len > buf_len) {
|
||||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -3197,7 +3188,7 @@ NTSTATUS nfs41_Create(
|
||||||
entry->u.Open.disp = params.Disposition;
|
entry->u.Open.disp = params.Disposition;
|
||||||
entry->u.Open.copts = params.CreateOptions;
|
entry->u.Open.copts = params.CreateOptions;
|
||||||
if (isDataAccess(params.DesiredAccess))
|
if (isDataAccess(params.DesiredAccess))
|
||||||
entry->u.Open.open_owner_id = get_next_open_owner();
|
entry->u.Open.open_owner_id = InterlockedIncrement(&open_owner_id);
|
||||||
// if we are creating a file check if nfsv3attributes were passed in
|
// if we are creating a file check if nfsv3attributes were passed in
|
||||||
if (params.Disposition != FILE_OPEN && params.Disposition != FILE_OVERWRITE) {
|
if (params.Disposition != FILE_OPEN && params.Disposition != FILE_OVERWRITE) {
|
||||||
if (RxContext->CurrentIrp->AssociatedIrp.SystemBuffer) {
|
if (RxContext->CurrentIrp->AssociatedIrp.SystemBuffer) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue