- From af4287695d5ea6c0c339cdef7804baa2f7e06a3e Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 7 Oct 2024 11:44:13 +0200
- Subject: [PATCH 1/6] sys: More prefix debug output
- %x-->0x%x,%p-->0x%p,%o-->0%o,NTSTATUS-->0x%x
- More prefix debug output %x-->0x%x,%p-->0x%p,%o-->0%o,NTSTATUS-->0x%x
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41_debug.c | 170 +++++++++++++++++++++++++--------------------
- sys/nfs41_driver.c | 29 ++++----
- 2 files changed, 109 insertions(+), 90 deletions(-)
- diff --git a/sys/nfs41_debug.c b/sys/nfs41_debug.c
- index d169611..9aca146 100644
- --- a/sys/nfs41_debug.c
- +++ b/sys/nfs41_debug.c
- @@ -3,6 +3,7 @@
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -50,8 +51,8 @@ ULONG __cdecl DbgP(IN PCCH fmt, ...)
- RtlTimeToTimeFields(&local_time, &time_fields);
- DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL,
- - "[%ld].[%02u:%02u:%02u.%u] %s", IoGetCurrentProcess(),
- - time_fields.Hour, time_fields.Minute, time_fields.Second,
- + "[%ld].[%02u:%02u:%02u.%u] %s", IoGetCurrentProcess(),
- + time_fields.Hour, time_fields.Minute, time_fields.Second,
- time_fields.Milliseconds, msg);
- #else
- DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL,
- @@ -191,7 +192,8 @@ void print_driver_state(int state)
- void print_basic_info(int on, PFILE_BASIC_INFORMATION info)
- {
- if (!on) return;
- - DbgP("BASIC_INFO: Create=%lx Access=%lx Write=%lx Change=%lx Attr=%x\n",
- + DbgP("BASIC_INFO: "
- + "Create=0x%lx Access=0x%lx Write=0x%lx Change=0x%lx Attr=0x%x\n",
- info->CreationTime.QuadPart, info->LastAccessTime.QuadPart,
- info->LastWriteTime.QuadPart, info->ChangeTime.QuadPart,
- info->FileAttributes);
- @@ -199,7 +201,8 @@ void print_basic_info(int on, PFILE_BASIC_INFORMATION info)
- void print_std_info(int on, PFILE_STANDARD_INFORMATION info)
- {
- if (!on) return;
- - DbgP("STD_INFO: Type=%s #Links=%d Alloc=%lx EOF=%lx Delete=%d\n",
- + DbgP("STD_INFO: "
- + "Type='%s' #Links=%d Alloc=0x%lx EOF=0x%lx Delete=%d\n",
- info->Directory?"DIR":"FILE", info->NumberOfLinks,
- info->AllocationSize.QuadPart, info->EndOfFile.QuadPart,
- info->DeletePending);
- @@ -207,8 +210,9 @@ void print_std_info(int on, PFILE_STANDARD_INFORMATION info)
- void print_ea_info(PFILE_FULL_EA_INFORMATION info)
- {
- - DbgP("FULL_EA_INFO: NextOffset=%d Flags=%x EaNameLength=%d "
- - "ExValueLength=%x EaName=%s\n", info->NextEntryOffset, info->Flags,
- + DbgP("FULL_EA_INFO: NextOffset=%d Flags=0x%x EaNameLength=%d "
- + "ExValueLength=0x%x EaName='%s'\n",
- + info->NextEntryOffset, info->Flags,
- info->EaNameLength, info->EaValueLength, info->EaName);
- #if DEBUG_EAINFO_DETAILS
- if (info->EaValueLength)
- @@ -221,22 +225,23 @@ void print_ea_info(PFILE_FULL_EA_INFORMATION info)
- void print_get_ea(int on, PFILE_GET_EA_INFORMATION info)
- {
- if (!on || !info) return;
- - DbgP("GET_EA_INFO: NextOffset=%d EaNameLength=%d EaName=%s\n",
- + DbgP("GET_EA_INFO: NextOffset=%d EaNameLength=%d EaName='%s'\n",
- info->NextEntryOffset, info->EaNameLength, info->EaName);
- }
- VOID print_srv_call(IN PMRX_SRV_CALL p)
- {
- - DbgP("PMRX_SRV_CALL %p\n", p);
- + DbgP("PMRX_SRV_CALL 0x%p\n", p);
- #if 0
- DbgP("\tNodeReferenceCount %ld\n", p->NodeReferenceCount);
- - //DbgP("Context %p\n", p->Context);
- - //DbgP("Context2 %p\n", p->Context2);
- - //DbgP("pSrvCallName %wZ\n", p->pSrvCallName);
- - //DbgP("pPrincipalName %wZ\n", p->pPrincipalName);
- - //DbgP("PDomainName %wZ\n", p->pDomainName);
- + //DbgP("Context 0x%p\n", p->Context);
- + //DbgP("Context2 0x%p\n", p->Context2);
- + //DbgP("pSrvCallName '%wZ'\n", p->pSrvCallName);
- + //DbgP("pPrincipalName '%wZ'\n", p->pPrincipalName);
- + //DbgP("PDomainName '%wZ'\n", p->pDomainName);
- //DbgP("Flags %08lx\n", p->Flags);
- - //DbgP("MaximumNumberOfCloseDelayedFiles %ld\n", p->MaximumNumberOfCloseDelayedFiles);
- + //DbgP("MaximumNumberOfCloseDelayedFiles %ld\n",
- + // p->MaximumNumberOfCloseDelayedFiles);
- //DbgP("Status %ld\n", p->Status);
- DbgP("*****************\n");
- #endif
- @@ -244,41 +249,41 @@ VOID print_srv_call(IN PMRX_SRV_CALL p)
- VOID print_net_root(IN PMRX_NET_ROOT p)
- {
- - DbgP("PMRX_NET_ROOT %p\n", p);
- + DbgP("PMRX_NET_ROOT 0x%p\n", p);
- #if 0
- DbgP("\tNodeReferenceCount %ld\n", p->NodeReferenceCount);
- - DbgP("\tpSrvCall %p\n", p->pSrvCall);
- - //DbgP("Context %p\n", p->Context);
- - //DbgP("Context2 %p\n", p->Context2);
- - //DbgP("Flags %08lx\n", p->Flags);
- + DbgP("\tpSrvCall 0x%p\n", p->pSrvCall);
- + //DbgP("Context 0x%p\n", p->Context);
- + //DbgP("Context2 0x%p\n", p->Context2);
- + //DbgP("Flags 0x%08lx\n", p->Flags);
- DbgP("\tNumberOfFcbs %ld\n", p->NumberOfFcbs);
- DbgP("\tNumberofSrvOpens %ld\n", p->NumberOfSrvOpens);
- //DbgP("MRxNetRootState %ld\n", p->MRxNetRootState);
- //DbgP("Type %ld\n", p->Type);
- //DbgP("DeviceType %ld\n", p->DeviceType);
- - //DbgP("pNetRootName %wZ\n", p->pNetRootName);
- - //DbgP("InnerNamePrefix %wZ\n", &p->InnerNamePrefix);
- + //DbgP("pNetRootName '%wZ'\n", p->pNetRootName);
- + //DbgP("InnerNamePrefix '%wZ'\n", &p->InnerNamePrefix);
- DbgP("*****************\n");
- #endif
- }
- VOID print_v_net_root(IN PMRX_V_NET_ROOT p)
- {
- - DbgP("PMRX_V_NET_ROOT %p\n", p);
- + DbgP("PMRX_V_NET_ROOT 0x%p\n", p);
- #if 0
- DbgP("\tNodeReferenceCount %ld\n", p->NodeReferenceCount);
- - DbgP("\tpNetRoot %p\n", p->pNetRoot);
- - //DbgP("Context %p\n", p->Context);
- - //DbgP("Context2 %p\n", p->Context2);
- - //DbgP("Flags %08lx\n", p->Flags);
- + DbgP("\tpNetRoot 0x%p\n", p->pNetRoot);
- + //DbgP("Context 0x%p\n", p->Context);
- + //DbgP("Context2 0x%p\n", p->Context2);
- + //DbgP("Flags 0x%08lx\n", p->Flags);
- DbgP("\tNumberofOpens %ld\n", p->NumberOfOpens);
- DbgP("\tNumberofFobxs %ld\n", p->NumberOfFobxs);
- //DbgP("LogonId\n");
- - //DbgP("pUserDomainName %wZ\n", p->pUserDomainName);
- - //DbgP("pUserName %wZ\n", p->pUserName);
- - //DbgP("pPassword %wZ\n", p->pPassword);
- + //DbgP("pUserDomainName '%wZ'\n", p->pUserDomainName);
- + //DbgP("pUserName '%wZ'\n", p->pUserName);
- + //DbgP("pPassword '%wZ'\n", p->pPassword);
- //DbgP("SessionId %ld\n", p->SessionId);
- - //DbgP("ConstructionStatus %08lx\n", p->ConstructionStatus);
- + //DbgP("ConstructionStatus 0x%08lx\n", p->ConstructionStatus);
- //DbgP("IsExplicitConnection %d\n", p->IsExplicitConnection);
- DbgP("*****************\n");
- #endif
- @@ -287,18 +292,20 @@ VOID print_v_net_root(IN PMRX_V_NET_ROOT p)
- void print_file_object(int on, PFILE_OBJECT file)
- {
- if (!on) return;
- - DbgP("FsContext %p FsContext2 %p\n", file->FsContext, file->FsContext2);
- + DbgP("FsContext 0x%p FsContext2 0x%p\n",
- + file->FsContext, file->FsContext2);
- DbgP("DeletePending %d ReadAccess %d WriteAccess %d DeleteAccess %d\n",
- file->DeletePending, file->WriteAccess, file->DeleteAccess);
- - DbgP("SharedRead %d SharedWrite %d SharedDelete %d Flags %x\n",
- - file->SharedRead, file->SharedWrite, file->SharedDelete, file->Flags);
- + DbgP("SharedRead %d SharedWrite %d SharedDelete %d Flags 0x%x\n",
- + file->SharedRead, file->SharedWrite, file->SharedDelete,
- + file->Flags);
- }
- void print_fo_all(int on, PRX_CONTEXT c)
- {
- if (!on) return;
- if (c->pFcb && c->pRelevantSrvOpen)
- - DbgP("OpenCount %d FCB %p SRV %p FOBX %p VNET %p NET %p\n",
- + DbgP("OpenCount %d FCB 0x%p SRV 0x%p FOBX 0x%p VNET 0x%p NET 0x%p\n",
- c->pFcb->OpenCount, c->pFcb, c->pRelevantSrvOpen, c->pFobx,
- c->pRelevantSrvOpen->pVNetRoot, c->pFcb->pNetRoot);
- }
- @@ -306,17 +313,18 @@ void print_fo_all(int on, PRX_CONTEXT c)
- VOID print_fcb(int on, IN PMRX_FCB p)
- {
- if (!on) return;
- - DbgP("PMRX_FCB %p OpenCount %d\n", p, p->OpenCount);
- + DbgP("PMRX_FCB 0x%p OpenCount %d\n", p, p->OpenCount);
- #if 0
- DbgP("\tNodeReferenceCount %ld\n", p->NodeReferenceCount);
- - DbgP("\tpNetRoot %p\n", p->pNetRoot);
- - //DbgP("Context %p\n", p->Context);
- - //DbgP("Context2 %p\n", p->Context2);
- + DbgP("\tpNetRoot 0x%p\n", p->pNetRoot);
- + //DbgP("Context 0x%p\n", p->Context);
- + //DbgP("Context2 0x%p\n", p->Context2);
- //DbgP("FcbState %ld\n", p->FcbState);
- //DbgP("UncleanCount %ld\n", p->UncleanCount);
- //DbgP("UncachedUncleanCount %ld\n", p->UncachedUncleanCount);
- DbgP("\tOpenCount %ld\n", p->OpenCount);
- - //DbgP("OutstandingLockOperationsCount %ld\n", p->OutstandingLockOperationsCount);
- + //DbgP("OutstandingLockOperationsCount %ld\n",
- + // p->OutstandingLockOperationsCount);
- //DbgP("ActualAllocationLength %ull\n", p->ActualAllocationLength);
- //DbgP("Attributes %ld\n", p->Attributes);
- //DbgP("IsFileWritten %d\n", p->IsFileWritten);
- @@ -332,18 +340,18 @@ VOID print_fcb(int on, IN PMRX_FCB p)
- VOID print_srv_open(int on, IN PMRX_SRV_OPEN p)
- {
- if (!on) return;
- - DbgP("PMRX_SRV_OPEN %p\n", p);
- + DbgP("PMRX_SRV_OPEN 0x%p\n", p);
- #if 0
- DbgP("\tNodeReferenceCount %ld\n", p->NodeReferenceCount);
- - DbgP("\tpFcb %p\n", p->pFcb);
- - DbgP("\tpVNetRoot %p\n", p->pVNetRoot);
- - //DbgP("Context %p\n", p->Context);
- - //DbgP("Context2 %p\n", p->Context2);
- - //DbgP("Flags %08lx\n", p->Flags);
- - //DbgP("pAlreadyPrefixedName %wZ\n", p->pAlreadyPrefixedName);
- + DbgP("\tpFcb 0x%p\n", p->pFcb);
- + DbgP("\tpVNetRoot 0x%p\n", p->pVNetRoot);
- + //DbgP("Context 0x%p\n", p->Context);
- + //DbgP("Context2 0x%p\n", p->Context2);
- + //DbgP("Flags 0x%08lx\n", p->Flags);
- + //DbgP("pAlreadyPrefixedName '%wZ'\n", p->pAlreadyPrefixedName);
- //DbgP("UncleanFobxCount %ld\n", p->UncleanFobxCount);
- DbgP("\tOpenCount %ld\n", p->OpenCount);
- - //DbgP("Key %p\n", p->Key);
- + //DbgP("Key 0x%p\n", p->Key);
- //DbgP("DesiredAccess\n");
- //DbgP("ShareAccess %ld\n", p->ShareAccess);
- //DbgP("CreateOptions %ld\n", p->CreateOptions);
- @@ -357,14 +365,14 @@ VOID print_srv_open(int on, IN PMRX_SRV_OPEN p)
- VOID print_fobx(int on, IN PMRX_FOBX p)
- {
- if (!on) return;
- - DbgP("PMRX_FOBX %p\n", p);
- + DbgP("PMRX_FOBX 0x%p\n", p);
- #if 0
- DbgP("\tNodeReferenceCount %ld\n", p->NodeReferenceCount);
- - DbgP("\tpSrvOpen %p\n", p->pSrvOpen);
- - DbgP("\tAssociatedFileObject %p\n", p->AssociatedFileObject);
- - //DbgP("Context %p\n", p->Context);
- - //DbgP("Context2 %p\n", p->Context2);
- - //DbgP("Flags %08lx\n", p->Flags);
- + DbgP("\tpSrvOpen 0x%p\n", p->pSrvOpen);
- + DbgP("\tAssociatedFileObject 0x%p\n", p->AssociatedFileObject);
- + //DbgP("Context 0x%p\n", p->Context);
- + //DbgP("Context2 0x%p\n", p->Context2);
- + //DbgP("Flags 0x%08lx\n", p->Flags);
- DbgP("*****************\n");
- #endif
- }
- @@ -373,7 +381,11 @@ VOID print_irp_flags(int on, PIRP irp)
- {
- if (!on) return;
- if (irp->Flags)
- - DbgP("IRP FLAGS: 0x%x %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
- + DbgP("IRP FLAGS: "
- + "0x%x "
- + "'%s' '%s' '%s' '%s' "
- + "'%s' '%s' '%s' '%s' "
- + "'%s' '%s' '%s' '%s' '%s' '%s'\n",
- irp->Flags,
- (irp->Flags & IRP_NOCACHE)?"NOCACHE":"",
- (irp->Flags & IRP_PAGING_IO)?"PAGING_IO":"",
- @@ -395,7 +407,7 @@ void print_irps_flags(int on, PIO_STACK_LOCATION irps)
- {
- if (!on) return;
- if (irps->Flags)
- - DbgP("IRPSP FLAGS 0x%x %s %s %s %s\n", irps->Flags,
- + DbgP("IRPSP FLAGS 0x%x '%s' '%s' '%s' '%s'\n", irps->Flags,
- (irps->Flags & SL_CASE_SENSITIVE)?"CASE_SENSITIVE":"",
- (irps->Flags & SL_OPEN_PAGING_FILE)?"PAGING_FILE":"",
- (irps->Flags & SL_FORCE_ACCESS_CHECK)?"ACCESS_CHECK":"",
- @@ -405,7 +417,9 @@ void print_nt_create_params(int on, NT_CREATE_PARAMETERS params)
- {
- if (!on) return;
- if (params.FileAttributes)
- - DbgP("File attributes %x: %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
- + DbgP("File attributes 0x%x: "
- + "'%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' "
- + "'%s' '%s' '%s' '%s' '%s'\n",
- params.FileAttributes,
- (params.FileAttributes & FILE_ATTRIBUTE_TEMPORARY)?"TEMPFILE ":"",
- (params.FileAttributes & FILE_ATTRIBUTE_READONLY)?"READONLY ":"",
- @@ -435,8 +449,11 @@ void print_nt_create_params(int on, NT_CREATE_PARAMETERS params)
- if (params.Disposition == FILE_OVERWRITE_IF)
- DbgP("Create Dispositions: FILE_OVERWRITE_IF\n");
- - DbgP("Create Attributes: 0x%x %s %s %s %s %s %s %s %s %s %s %s %s %s %s "
- - "%s %s\n", params.CreateOptions,
- + DbgP("Create Attributes: "
- + "0x%x "
- + "'%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' "
- + "'%s' '%s' '%s' '%s' '%s' '%s' '%s'\n",
- + params.CreateOptions,
- (params.CreateOptions & FILE_DIRECTORY_FILE)?"DIRFILE":"",
- (params.CreateOptions & FILE_NON_DIRECTORY_FILE)?"FILE":"",
- (params.CreateOptions & FILE_DELETE_ON_CLOSE)?"DELETE_ON_CLOSE":"",
- @@ -454,12 +471,13 @@ void print_nt_create_params(int on, NT_CREATE_PARAMETERS params)
- (params.CreateOptions & FILE_OPEN_FOR_BACKUP_INTENT)?"4_BACKUP":"",
- (params.CreateOptions & FILE_RESERVE_OPFILTER)?"OPFILTER":"");
- - DbgP("Share Access: %s %s %s\n",
- + DbgP("Share Access: '%s' '%s' '%s'\n",
- (params.ShareAccess & FILE_SHARE_READ)?"READ":"",
- (params.ShareAccess & FILE_SHARE_WRITE)?"WRITE":"",
- (params.ShareAccess & FILE_SHARE_DELETE)?"DELETE":"");
- - DbgP("Desired Access: 0x%x %s %s %s %s %s %s %s %s %s %s %s\n",
- + DbgP("Desired Access: "
- + "0x%x '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s'\n",
- params.DesiredAccess,
- (params.DesiredAccess & FILE_READ_DATA)?"READ":"",
- (params.DesiredAccess & STANDARD_RIGHTS_READ)?"READ_ACL":"",
- @@ -568,18 +586,18 @@ void print_caching_level(int on, ULONG flag, PUNICODE_STRING name)
- {
- if (!on) return;
- switch(flag) {
- - case 0:
- - DbgP("enable_caching: DISABLE_CACHING %wZ\n", name);
- + case 0:
- + DbgP("enable_caching: DISABLE_CACHING '%wZ'\n", name);
- break;
- case 1:
- - DbgP("enable_caching: ENABLE_READ_CACHING %wZ\n", name);
- + DbgP("enable_caching: ENABLE_READ_CACHING '%wZ'\n", name);
- break;
- case 2:
- - DbgP("enable_caching: ENABLE_WRITE_CACHING %wZ\n", name);
- + DbgP("enable_caching: ENABLE_WRITE_CACHING '%wZ'\n", name);
- break;
- case 3:
- - DbgP("enable_caching: ENABLE_READWRITE_CACHING %wZ\n", name);
- - break;
- + DbgP("enable_caching: ENABLE_READWRITE_CACHING '%wZ'\n", name);
- + break;
- }
- }
- @@ -611,7 +629,7 @@ const char *opcode2string(int opcode)
- void print_acl_args(
- SECURITY_INFORMATION info)
- {
- - DbgP("Security query: %s %s %s\n",
- + DbgP("Security query: '%s' '%s' '%s'\n",
- (info & OWNER_SECURITY_INFORMATION)?"OWNER":"",
- (info & GROUP_SECURITY_INFORMATION)?"GROUP":"",
- (info & DACL_SECURITY_INFORMATION)?"DACL":"",
- @@ -670,26 +688,26 @@ void print_open_error(int on, int status)
- }
- }
- -void print_wait_status(int on, const char *prefix, NTSTATUS status,
- - const char *opcode, PVOID entry, LONGLONG xid)
- +void print_wait_status(int on, const char *prefix, NTSTATUS status,
- + const char *opcode, PVOID entry, LONGLONG xid)
- {
- if (!on) return;
- switch (status) {
- case STATUS_SUCCESS:
- if (opcode)
- - DbgP("%s Got a wakeup call, finishing %s entry=%p xid=%lld\n",
- + DbgP("'%s' Got a wakeup call, finishing '%s' entry=0x%p xid=%lld\n",
- prefix, opcode, entry, xid);
- else
- - DbgP("%s Got a wakeup call\n", prefix);
- + DbgP("'%s' Got a wakeup call\n", prefix);
- break;
- case STATUS_USER_APC:
- - DbgP("%s KeWaitForSingleObject returned STATUS_USER_APC\n", prefix);
- + DbgP("'%s' KeWaitForSingleObject returned STATUS_USER_APC\n", prefix);
- break;
- case STATUS_ALERTED:
- - DbgP("%s KeWaitForSingleObject returned STATUS_ALERTED\n", prefix);
- + DbgP("'%s' KeWaitForSingleObject returned STATUS_ALERTED\n", prefix);
- break;
- default:
- - DbgP("%s KeWaitForSingleObject returned %d\n", prefix, status);
- + DbgP("'%s' KeWaitForSingleObject returned %d\n", prefix, status);
- }
- }
- /* This is taken from toaster/func. Rumor says this should be replaced
- @@ -722,9 +740,9 @@ dprintk(
- if (!NT_SUCCESS(status))
- rv = DbgPrintEx(PNFS_FLTR_ID, DPFLTR_MASK | flags,
- - "RtlStringCbVPrintfA failed %x \n", status);
- + "RtlStringCbVPrintfA failed 0x%x \n", status);
- else
- - rv = DbgPrintEx(PNFS_FLTR_ID, DPFLTR_MASK | flags, "%s %s: %s\n",
- + rv = DbgPrintEx(PNFS_FLTR_ID, DPFLTR_MASK | flags, "'%s' '%s': '%s'\n",
- PNFS_TRACE_TAG, func, debugMessageBuffer);
- }
- va_end(list);
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 1214fa8..aad56bf 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -968,9 +968,10 @@ static NTSTATUS marshal_nfs41_lock(
- *len = header_len;
- #ifdef DEBUG_MARSHAL_DETAIL
- - DbgP("marshal_nfs41_lock: offset=%llx length=%llx exclusive=%u "
- - "blocking=%u\n", entry->u.Lock.offset, entry->u.Lock.length,
- - entry->u.Lock.exclusive, entry->u.Lock.blocking);
- + DbgP("marshal_nfs41_lock: "
- + "offset=0x%llx length=0x%llx exclusive=%u "
- + "blocking=%u\n", entry->u.Lock.offset, entry->u.Lock.length,
- + entry->u.Lock.exclusive, entry->u.Lock.blocking);
- #endif
- out:
- return status;
- @@ -2686,7 +2687,7 @@ static NTSTATUS nfs41_DevFcbXXXControlFile(
- status = STATUS_SUCCESS;
- } else if (status == STATUS_PENDING &&
- RxContext->PostRequest == TRUE) {
- - DbgP("RxStartMinirdr pending %08lx\n", status);
- + DbgP("RxStartMinirdr pending 0x%08lx\n", status);
- status = STATUS_MORE_PROCESSING_REQUIRED;
- }
- break;
- @@ -2713,7 +2714,7 @@ static NTSTATUS nfs41_DevFcbXXXControlFile(
- NFS41_START_DRIVER_STARTED);
- status = RxStopMinirdr(RxContext, &RxContext->PostRequest);
- - DbgP("RxStopMinirdr status %08lx\n", status);
- + DbgP("RxStopMinirdr status 0x%08lx\n", status);
- if (status == STATUS_PENDING && RxContext->PostRequest == TRUE )
- status = STATUS_MORE_PROCESSING_REQUIRED;
- break;
- @@ -2806,7 +2807,7 @@ static NTSTATUS nfs41_CreateSrvCall(
- status = RxDispatchToWorkerThread(nfs41_dev, DelayedWorkQueue,
- _nfs41_CreateSrvCall, pCallbackContext);
- if (status != STATUS_SUCCESS) {
- - print_error("RxDispatchToWorkerThread returned status %08lx\n",
- + print_error("RxDispatchToWorkerThread returned status 0x%08lx\n",
- status);
- pCallbackContext->Status = status;
- pCallbackContext->SrvCalldownStructure->CallBack(pCallbackContext);
- @@ -3175,7 +3176,7 @@ static NTSTATUS nfs41_MountConfig_ParseOptions(
- if (status == STATUS_SUCCESS) {
- if (Config->createmode.mode > 0777) {
- status = STATUS_INVALID_PARAMETER;
- - print_error("mode 0o%o out of bounds\n",
- + print_error("mode 0%o out of bounds\n",
- (int)Config->createmode.mode);
- }
- }
- @@ -3188,7 +3189,7 @@ static NTSTATUS nfs41_MountConfig_ParseOptions(
- DbgP("nfs41_MountConfig_ParseOptions: createmode: "
- "status=0x%lx, "
- - "createmode=(use_nfsv3attrsea_mode=%d, mode=0o%o\n",
- + "createmode=(use_nfsv3attrsea_mode=%d, mode=0%o\n",
- (long)status,
- (int)Config->createmode.use_nfsv3attrsea_mode,
- (int)Config->createmode.mode);
- @@ -3605,7 +3606,7 @@ static NTSTATUS nfs41_CreateVNetRoot(
- "timebasedcoherency=%d "
- "timeout=%d "
- "createmode.use_nfsv3attrsea_mode=%d "
- - "Config->createmode.mode=0o%o "
- + "Config->createmode.mode=0%o "
- "}\n",
- &Config->MntPt,
- &Config->SrvName,
- @@ -4394,7 +4395,7 @@ retry_on_link:
- status = RxPrepareToReparseSymbolicLink(RxContext,
- entry->u.Open.symlink_embedded, &AbsPath, TRUE, &ReparseRequired);
- #ifdef DEBUG_OPEN
- - DbgP("RxPrepareToReparseSymbolicLink(%u, '%wZ') returned %08lX, "
- + DbgP("RxPrepareToReparseSymbolicLink(%u, '%wZ') returned 0x%08lX, "
- "FileName is '%wZ'\n", entry->u.Open.symlink_embedded,
- &AbsPath, status, &RxContext->CurrentIrpSp->FileObject->FileName);
- #endif
- @@ -5784,7 +5785,7 @@ static NTSTATUS nfs41_QuerySecurityInformation(
- LARGE_INTEGER current_time;
- KeQuerySystemTime(¤t_time);
- #ifdef DEBUG_ACL_QUERY
- - DbgP("CurrentTime %lx Saved Acl time %lx\n",
- + DbgP("CurrentTime 0x%lx Saved Acl time 0x%lx\n",
- current_time.QuadPart, nfs41_fobx->time.QuadPart);
- #endif
- if (current_time.QuadPart - nfs41_fobx->time.QuadPart <= 20*1000) {
- @@ -7832,7 +7833,7 @@ NTSTATUS DriverEntry(
- status = RxDriverEntry(drv, path);
- if (status != STATUS_SUCCESS) {
- - print_error("RxDriverEntry failed: %08lx\n", status);
- + print_error("RxDriverEntry failed: 0x%08lx\n", status);
- goto out;
- }
- @@ -7850,7 +7851,7 @@ NTSTATUS DriverEntry(
- sizeof(NFS41_DEVICE_EXTENSION),
- FILE_DEVICE_NETWORK_FILE_SYSTEM, FILE_REMOTE_DEVICE);
- if (status != STATUS_SUCCESS) {
- - print_error("RxRegisterMinirdr failed: %08lx\n", status);
- + print_error("RxRegisterMinirdr failed: 0x%08lx\n", status);
- goto out;
- }
- nfs41_dev->Flags |= DO_BUFFERED_IO;
- @@ -7867,7 +7868,7 @@ NTSTATUS DriverEntry(
- DbgP("calling IoCreateSymbolicLink '%wZ' '%wZ'\n", &user_dev_name, &dev_name);
- status = IoCreateSymbolicLink(&user_dev_name, &dev_name);
- if (status != STATUS_SUCCESS) {
- - print_error("Device name IoCreateSymbolicLink failed: %08lx\n", status);
- + print_error("Device name IoCreateSymbolicLink failed: 0x%08lx\n", status);
- goto out_unregister;
- }
- --
- 2.45.1
- From 9b60e347107913652d25dfd23283a499150bbc9a Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 7 Oct 2024 13:03:02 +0200
- Subject: [PATCH 2/6] daemon,include,sys: Add |FILE_OPEN_REQUIRING_OPLOCK|,
- |FILE_DISALLOW_EXCLUSIVE|, |FILE_SESSION_AWARE| flags
- Add |FILE_OPEN_REQUIRING_OPLOCK|, |FILE_DISALLOW_EXCLUSIVE|, and
- |FILE_SESSION_AWARE| flags
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/daemon_debug.c | 8 ++++++++
- include/from_kernel.h | 4 ++++
- sys/nfs41_debug.c | 4 +++-
- 3 files changed, 15 insertions(+), 1 deletion(-)
- diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
- index fb155ed..8f58414 100644
- --- a/daemon/daemon_debug.c
- +++ b/daemon/daemon_debug.c
- @@ -273,6 +273,14 @@ void print_create_attributes(int level, DWORD create_opts) {
- fprintf(dlog_file, "OPEN_BY_FILE_ID ");
- if (create_opts & FILE_OPEN_FOR_BACKUP_INTENT)
- fprintf(dlog_file, "OPEN_FOR_BACKUP_INTENT ");
- + if (create_opts & FILE_NO_COMPRESSION)
- + fprintf(dlog_file, "NO_COMPRESSION ");
- + if (create_opts & FILE_OPEN_REQUIRING_OPLOCK)
- + fprintf(dlog_file, "OPEN_REQUIRING_OPLOCK ");
- + if (create_opts & FILE_DISALLOW_EXCLUSIVE)
- + fprintf(dlog_file, "DISALLOW_EXCLUSIVE ");
- + if (create_opts & FILE_SESSION_AWARE)
- + fprintf(dlog_file, "SESSION_AWARE ");
- if (create_opts & FILE_RESERVE_OPFILTER)
- fprintf(dlog_file, "RESERVE_OPFILTER");
- fprintf(dlog_file, "\n");
- diff --git a/include/from_kernel.h b/include/from_kernel.h
- index 8cd6c8b..b661c6b 100644
- --- a/include/from_kernel.h
- +++ b/include/from_kernel.h
- @@ -42,6 +42,10 @@
- #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
- #define FILE_NO_COMPRESSION 0x00008000
- +#define FILE_OPEN_REQUIRING_OPLOCK 0x00010000
- +#define FILE_DISALLOW_EXCLUSIVE 0x00020000
- +#define FILE_SESSION_AWARE 0x00040000
- +
- #define FILE_RESERVE_OPFILTER 0x00100000
- #define FILE_OPEN_REPARSE_POINT 0x00200000
- #define FILE_OPEN_NO_RECALL 0x00400000
- diff --git a/sys/nfs41_debug.c b/sys/nfs41_debug.c
- index 9aca146..603f397 100644
- --- a/sys/nfs41_debug.c
- +++ b/sys/nfs41_debug.c
- @@ -452,7 +452,7 @@ void print_nt_create_params(int on, NT_CREATE_PARAMETERS params)
- DbgP("Create Attributes: "
- "0x%x "
- "'%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' "
- - "'%s' '%s' '%s' '%s' '%s' '%s' '%s'\n",
- + "'%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s'\n",
- params.CreateOptions,
- (params.CreateOptions & FILE_DIRECTORY_FILE)?"DIRFILE":"",
- (params.CreateOptions & FILE_NON_DIRECTORY_FILE)?"FILE":"",
- @@ -469,6 +469,8 @@ void print_nt_create_params(int on, NT_CREATE_PARAMETERS params)
- (params.CreateOptions & FILE_OPEN_REPARSE_POINT)?"OPEN_REPARSE":"",
- (params.CreateOptions & FILE_OPEN_BY_FILE_ID)?"BY_ID":"",
- (params.CreateOptions & FILE_OPEN_FOR_BACKUP_INTENT)?"4_BACKUP":"",
- + (params.CreateOptions & FILE_OPEN_REQUIRING_OPLOCK)?"REQUIRING_OPLOCK":"",
- + (params.CreateOptions & FILE_DISALLOW_EXCLUSIVE)?"DISALLOW_EXCLUSIVE":"",
- (params.CreateOptions & FILE_RESERVE_OPFILTER)?"OPFILTER":"");
- DbgP("Share Access: '%s' '%s' '%s'\n",
- --
- 2.45.1
- From ac84343c048b62a50e6075849ec833b5b2a2f18e Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 7 Oct 2024 13:24:06 +0200
- Subject: [PATCH 3/6] daemon: Add |EASSERT_MSG()| for unsupported create
- opts+reject |FILE_OPEN_REQUIRING_OPLOCK|
- Add |EASSERT_MSG()| for unsupported create opts (i.e.
- |FILE_COMPLETE_IF_OPLOCKED|, |FILE_OPEN_BY_FILE_ID|,
- |FILE_OPEN_REQUIRING_OPLOCK|, |FILE_DISALLOW_EXCLUSIVE|, and
- |FILE_RESERVE_OPFILTER|) and reject open with
- |FILE_OPEN_REQUIRING_OPLOCK|.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/open.c | 21 +++++++++++++++++++++
- 1 file changed, 21 insertions(+)
- diff --git a/daemon/open.c b/daemon/open.c
- index 36f4cad..bdd6515 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -613,6 +613,27 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- nfs41_open_state *state;
- nfs41_file_info info = { 0 };
- + EASSERT_MSG(!(args->create_opts & FILE_COMPLETE_IF_OPLOCKED),
- + ("handle_open: file='%s': "
- + "FILE_COMPLETE_IF_OPLOCKED not supported\n", args->path));
- + EASSERT_MSG(!(args->create_opts & FILE_OPEN_BY_FILE_ID),
- + ("handle_open: file='%s': "
- + "FILE_OPEN_BY_FILE_ID not supported\n", args->path));
- + EASSERT_MSG(!(args->create_opts & FILE_OPEN_REQUIRING_OPLOCK),
- + ("handle_open: file='%s': "
- + "FILE_OPEN_REQUIRING_OPLOCK not supported\n", args->path));
- + EASSERT_MSG(!(args->create_opts & FILE_DISALLOW_EXCLUSIVE),
- + ("handle_open: file='%s': "
- + "FILE_DISALLOW_EXCLUSIVE not supported\n", args->path));
- + EASSERT_MSG(!(args->create_opts & FILE_RESERVE_OPFILTER),
- + ("handle_open: file='%s': "
- + "FILE_RESERVE_OPFILTER not supported\n", args->path));
- +
- + if (args->create_opts & FILE_OPEN_REQUIRING_OPLOCK) {
- + status = STATUS_INVALID_PARAMETER;
- + goto out;
- + }
- +
- status = create_open_state(args->path, args->open_owner_id, &state);
- if (status) {
- eprintf("create_open_state(%d) failed with %d\n",
- --
- 2.45.1
- From 0749af2fc6152cc12ef9dd68dff3ac7464aebd4c Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 7 Oct 2024 13:54:52 +0200
- Subject: [PATCH 4/6] daemon,sys: Reject |FILE_OPEN_REQUIRING_OPLOCK| already
- in the kernel
- Reject |FILE_OPEN_REQUIRING_OPLOCK| already in the kernel
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/open.c | 9 ++++-----
- sys/nfs41_driver.c | 6 ++++++
- 2 files changed, 10 insertions(+), 5 deletions(-)
- diff --git a/daemon/open.c b/daemon/open.c
- index bdd6515..28bb97a 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -619,6 +619,10 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- EASSERT_MSG(!(args->create_opts & FILE_OPEN_BY_FILE_ID),
- ("handle_open: file='%s': "
- "FILE_OPEN_BY_FILE_ID not supported\n", args->path));
- + /*
- + * Kernel rejects |FILE_OPEN_REQUIRING_OPLOCK|, we just use
- + * this here as safeguard
- + */
- EASSERT_MSG(!(args->create_opts & FILE_OPEN_REQUIRING_OPLOCK),
- ("handle_open: file='%s': "
- "FILE_OPEN_REQUIRING_OPLOCK not supported\n", args->path));
- @@ -629,11 +633,6 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- ("handle_open: file='%s': "
- "FILE_RESERVE_OPFILTER not supported\n", args->path));
- - if (args->create_opts & FILE_OPEN_REQUIRING_OPLOCK) {
- - status = STATUS_INVALID_PARAMETER;
- - goto out;
- - }
- -
- status = create_open_state(args->path, args->open_owner_id, &state);
- if (status) {
- eprintf("create_open_state(%d) failed with %d\n",
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index aad56bf..e1ad810 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -4196,6 +4196,12 @@ static NTSTATUS check_nfs41_create_args(
- goto out;
- }
- + /* We do not support oplocks (yet) */
- + if (params->CreateOptions & FILE_OPEN_REQUIRING_OPLOCK) {
- + status = STATUS_INVALID_PARAMETER;
- + goto out;
- + }
- +
- if (!areOpenParamsValid(params)) {
- status = STATUS_INVALID_PARAMETER;
- goto out;
- --
- 2.45.1
- From d205637778f218a7ac17fbebd8b06fc4fdbabe0d Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 7 Oct 2024 14:01:56 +0200
- Subject: [PATCH 5/6] tests: Add "msnfs41client" target to nfsbuildtest.ksh93
- Add "msnfs41client" target to nfsbuildtest.ksh93
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/nfsbuildtest/nfsbuildtest.ksh93 | 109 ++++++++++++++++++++++++++
- 1 file changed, 109 insertions(+)
- diff --git a/tests/nfsbuildtest/nfsbuildtest.ksh93 b/tests/nfsbuildtest/nfsbuildtest.ksh93
- index 4ea102b..ecb9681 100644
- --- a/tests/nfsbuildtest/nfsbuildtest.ksh93
- +++ b/tests/nfsbuildtest/nfsbuildtest.ksh93
- @@ -317,6 +317,103 @@ function bash_clean
- return 0
- }
- +function msnfs41client_createcache
- +{
- + set -o xtrace
- + set -o errexit
- + set -o nounset
- +
- + mkdir -p 'gitbundles'
- + rm -f 'gitbundles/ms-nfs41-client.bundle'
- +
- + git -c checkout.workers=16 clone 'https://github.com/kofemann/ms-nfs41-client.git'
- + cd 'ms-nfs41-client'
- + git config --global --add safe.directory "$PWD"
- + git bundle create '../gitbundles/ms-nfs41-client.bundle' --all
- + git config --global --unset safe.directory "$PWD"
- + cd ..
- + rm -Rf 'ms-nfs41-client'
- +
- + return 0
- +}
- +
- +
- +function msnfs41client_build
- +{
- + set -o xtrace
- + set -o errexit
- + set -o nounset
- +
- + #
- + # build config
- + #
- + typeset config_cp_p_function_not_implemented_workaround=false
- +
- + compound gitdata=(
- + typeset url='https://github.com/kofemann/ms-nfs41-client.git'
- + # use fixed git tag, so build times are compareable
- + typeset tag='master'
- + )
- +
- + #
- + # temp dir setup
- + #
- +
- + # fixme: Does not work with NFSv4.1 filesystem from exported Linux tmpfs - why ?
- + #tmpdir='/cygdrive/m/tmpdir'
- + #mkdir -p "$tmpdir"
- + #chmod a=rwxt "$tmpdir"
- + #if [[ -d "$tmpdir" && -w "$tmpdir" ]] ; then
- + # export TMPDIR="$tmpdir"
- + #fi
- +
- + #
- + # print user info
- + #
- + id -a
- + pwd
- +
- + #
- + # source checkout
- + #
- +
- + if [[ -f '../gitbundles/ms-nfs41-client.bundle' ]] ; then
- + # Use local bundle as cache,
- + # so build times only depend on local filesystem performance
- + # and not HTTPS speed
- + time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch '../gitbundles/ms-nfs41-client.bundle'
- + else
- + time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch "${gitdata.url}"
- + fi
- +
- + cd "$PWD/ms-nfs41-client/"
- +
- + #
- + # patch sources and configure build
- + #
- +
- + #
- + # build ms-nfs41-client
- + #
- + export PATH+=":/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/"
- + time make -j1 -f cygwin/Makefile bintarball
- + echo $?
- +
- + echo "#Done."
- + return 0
- +}
- +
- +
- +function msnfs41client_clean
- +{
- + set -o xtrace
- + set -o errexit
- + set -o nounset
- +
- + rm -Rf 'ms-nfs41-client'
- + return 0
- +}
- +
- builtin id
- builtin mkdir
- @@ -350,6 +447,18 @@ function main
- bash_clean
- return $?
- ;;
- + 'msnfs41client_createcache')
- + msnfs41client_createcache
- + return $?
- + ;;
- + 'msnfs41client_build')
- + msnfs41client_build
- + return $?
- + ;;
- + 'msnfs41client_clean')
- + msnfs41client_clean
- + return $?
- + ;;
- *)
- print -u2 -f $"%s: Unknown %q/%q combination." \
- "$0" "${target}" "${subcmd}"
- --
- 2.45.1
- From 21d8f3032ceba9b543079922942787336bc95384 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 7 Oct 2024 14:04:50 +0200
- Subject: [PATCH 6/6] tests: Fix bundle paths in nfsbuildtest.ksh93
- Fix bundle paths in nfsbuildtest.ksh93
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/nfsbuildtest/nfsbuildtest.ksh93 | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
- diff --git a/tests/nfsbuildtest/nfsbuildtest.ksh93 b/tests/nfsbuildtest/nfsbuildtest.ksh93
- index ecb9681..e24618e 100644
- --- a/tests/nfsbuildtest/nfsbuildtest.ksh93
- +++ b/tests/nfsbuildtest/nfsbuildtest.ksh93
- @@ -26,8 +26,8 @@ function gcc_createcache
- set -o errexit
- set -o nounset
- - mkdir -p 'gitbundles'
- - rm -f 'gitbundles/gcc.bundle'
- + mkdir -p '../gitbundles'
- + rm -f '../gitbundles/gcc.bundle'
- git -c checkout.workers=16 clone git://repo.or.cz/gcc.git
- cd gcc
- @@ -180,8 +180,8 @@ function bash_createcache
- set -o errexit
- set -o nounset
- - mkdir -p 'gitbundles'
- - rm -f 'gitbundles/bash.bundle'
- + mkdir -p '../gitbundles'
- + rm -f '../gitbundles/bash.bundle'
- git -c checkout.workers=16 clone 'https://github.com/bminor/bash.git'
- cd bash
- @@ -323,8 +323,8 @@ function msnfs41client_createcache
- set -o errexit
- set -o nounset
- - mkdir -p 'gitbundles'
- - rm -f 'gitbundles/ms-nfs41-client.bundle'
- + mkdir -p '../gitbundles'
- + rm -f '../gitbundles/ms-nfs41-client.bundle'
- git -c checkout.workers=16 clone 'https://github.com/kofemann/ms-nfs41-client.git'
- cd 'ms-nfs41-client'
- --
- 2.45.1
msnfs41client: Patch for rejecting OPLOCK open, tests, misc, 2024-10-07
Posted by Anonymous on Mon 7th Oct 2024 14:37
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.