- diff --git a/daemon/setattr.c b/daemon/setattr.c
- index 3c01a47..4ba0789 100644
- --- a/daemon/setattr.c
- +++ b/daemon/setattr.c
- @@ -32,7 +32,10 @@
- #undef _malloca
- #endif /* _DEBUG */
- #include <strsafe.h>
- -
- +
- +#include <devioctl.h>
- +#include "nfs41_driver.h" /* for |mark_filename_as_stale()| */
- +
- #include "nfs41_build_features.h"
- #include "from_kernel.h"
- #include "nfs41_ops.h"
- @@ -335,6 +338,44 @@ static int is_dst_name_opened(nfs41_abs_path *dst_path, nfs41_session *dst_sessi
- return status;
- }
- +static int mark_filename_as_stale(
- + IN nfs41_open_state *srcfile_state,
- + IN nfs41_abs_path *dst_path)
- +{
- + if (srcfile_state->srv_open == NULL) {
- + eprintf("mark_filename_as_stale: srcfile_state->srv_open == NULL\n");
- + return ERROR_INVALID_PARAMETER;
- + }
- +
- + /* make an upcall to the kernel: invalide data cache */
- + HANDLE pipe;
- + unsigned char inbuf[sizeof(HANDLE)+4096], *buffer = inbuf;
- + DWORD inbuf_len = sizeof(HANDLE)+sizeof(DWORD)+dst_path->len, outbuf_len, dstatus;
- + uint32_t length;
- +
- + pipe = create_nfs41sys_device_pipe();
- + if (pipe == INVALID_HANDLE_VALUE) {
- + eprintf("mark_filename_as_stale: "
- + "Unable to open downcall pipe, lasterr=%d\n",
- + (int)GetLastError());
- + return ERROR_INVALID_PARAMETER;
- + }
- + length = inbuf_len;
- + DWORD dst_path_len = dst_path->len;
- +
- + safe_write(&buffer, &length, &srcfile_state->srv_open, sizeof(HANDLE));
- + safe_write(&buffer, &length, &dst_path_len, sizeof(DWORD));
- + safe_write(&buffer, &length, dst_path->path, dst_path_len);
- +
- + dstatus = DeviceIoControl(pipe, IOCTL_NFS41_SET_STALE, inbuf, inbuf_len,
- + NULL, 0, (LPDWORD)&outbuf_len, NULL);
- + if (!dstatus)
- + eprintf("IOCTL_NFS41_SET_STALE failed %d\n", (int)GetLastError());
- + close_nfs41sys_device_pipe(pipe);
- +
- + return NO_ERROR;
- +}
- +
- static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- {
- nfs41_open_state *state = args->state;
- @@ -349,6 +390,7 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- #endif /* NFS41_REJECT_CYGWIN_SILLYRENAME_FOR_DIRS */
- int status;
- + args->rename_stale_dst_path_overwritten = false;
- src_name = &state->file.name;
- if (rename->FileNameLength == 0) {
- @@ -721,6 +763,16 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- nfs_error_string(status)));
- status = nfs_to_windows_error(status, ERROR_ACCESS_DENIED);
- } else {
- +#if 1
- + args->rename_stale_dst_path_overwritten = true;
- + abs_path_copy(&args->rename_stale_dst_path, &dst_path);
- +#else
- + /*
- + * Inform the kernel that the original destnation path is now stale,
- + * and cannot be used for SRVOPEN collapsing
- + */
- + mark_filename_as_stale(state, &dst_path);
- +#endif
- /* rename state->path on success */
- open_state_rename(state, &dst_path);
- }
- @@ -1080,8 +1132,28 @@ static int marshall_setattr(
- uint32_t *restrict length,
- nfs41_upcall *restrict upcall)
- {
- + int status;
- const setattr_upcall_args *args = &upcall->args.setattr;
- - return safe_write(&buffer, length, &args->ctime, sizeof(args->ctime));
- + status = safe_write(&buffer, length, &args->ctime, sizeof(args->ctime));
- + if (status) goto out;
- +
- + if (args->set_class == FileRenameInformation) {
- + status = safe_write(&buffer, length,
- + &args->rename_stale_dst_path_overwritten,
- + sizeof(args->rename_stale_dst_path_overwritten));
- + if (status) goto out;
- + if (args->rename_stale_dst_path_overwritten) {
- + USHORT dst_path_len = args->rename_stale_dst_path.len;
- + status = safe_write(&buffer, length, &dst_path_len, sizeof(dst_path_len));
- + if (status) goto out;
- + status = safe_write(&buffer, length,
- + &args->rename_stale_dst_path.path[0], dst_path_len);
- + if (status) goto out;
- + }
- + }
- +
- +out:
- + return status;
- }
- diff --git a/daemon/upcall.h b/daemon/upcall.h
- index 01a84ed..c75ca62 100644
- --- a/daemon/upcall.h
- +++ b/daemon/upcall.h
- @@ -140,6 +140,9 @@ typedef struct __setattr_upcall_args {
- uint32_t buf_len;
- int set_class;
- ULONGLONG ctime;
- + /* Downcall info */
- + BOOLEAN rename_stale_dst_path_overwritten;
- + nfs41_abs_path rename_stale_dst_path;
- } setattr_upcall_args;
- typedef struct __getexattr_upcall_args {
- diff --git a/include/nfs41_driver.h b/include/nfs41_driver.h
- index 12f14bf..91cf7e1 100644
- --- a/include/nfs41_driver.h
- +++ b/include/nfs41_driver.h
- @@ -53,6 +53,7 @@
- #define IOCTL_NFS41_DELAYXID _RDR_CTL_CODE(8, METHOD_BUFFERED)
- #define IOCTL_NFS41_INVALCACHE _RDR_CTL_CODE(9, METHOD_BUFFERED)
- #define IOCTL_NFS41_SET_DAEMON_DEBUG_LEVEL _RDR_CTL_CODE(10, METHOD_BUFFERED)
- +#define IOCTL_NFS41_SET_STALE _RDR_CTL_CODE(11, METHOD_BUFFERED)
- /*
- * NFS41_SYS_MAX_PATH_LEN - Maximum path length
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index 091e61a..4f92098 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -467,6 +467,83 @@ out:
- return status;
- }
- +NTSTATUS nfs41_set_stale(
- + IN PRX_CONTEXT RxContext)
- +{
- + PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
- + const unsigned char *inbuf = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
- + PMRX_SRV_OPEN srv_open;
- + PNET_ROOT pnet_root;
- + DWORD stale_utf8filename_bytelen = 0;
- + NTSTATUS status;
- +
- + RtlCopyMemory(&srv_open, inbuf, sizeof(HANDLE));
- + inbuf += sizeof(HANDLE);
- +
- + DbgP("nfs41_set_stale: received srv_open=0x%p srcfilename='%wZ'\n",
- + srv_open, srv_open->pAlreadyPrefixedName);
- +
- +#if 0
- + __try {
- +#endif
- + DbgP("nfs41_set_stale: #mark1\n");
- +
- + pnet_root = (PNET_ROOT)srv_open->pFcb->pNetRoot;
- +
- + DbgP("nfs41_set_stale: #mark2\n");
- +
- + RtlCopyMemory(&stale_utf8filename_bytelen, inbuf,
- + sizeof(stale_utf8filename_bytelen));
- + inbuf += sizeof(stale_utf8filename_bytelen);
- +
- + DbgP("nfs41_set_stale: #mark3\n");
- +
- + DbgP("nfs41_set_stale: stale_utf8filename_bytelen=%ld\n",
- + (long)stale_utf8filename_bytelen);
- +
- + DbgP("nfs41_set_stale: inbuf='%.*s'\n",
- + (int)stale_utf8filename_bytelen, inbuf);
- +
- + UTF8_STRING stale_utf8filename = {
- + .Length = (USHORT)stale_utf8filename_bytelen,
- + .MaximumLength = (USHORT)stale_utf8filename_bytelen,
- + .Buffer = (PCHAR)inbuf
- + };
- +
- + DbgP("nfs41_set_stale: #mark4\n");
- +
- + UNICODE_STRING stale_filename;
- +
- + status = RtlUTF8StringToUnicodeString(&stale_filename,
- + &stale_utf8filename, TRUE);
- + if (NT_SUCCESS(status)) {
- + DbgP("nfs41_set_stale: stale_filename='%wZ'\n",
- + &stale_filename);
- +
- + nfs41_mark_file_as_non_collapsible(pnet_root,
- + &stale_filename);
- +
- + RtlFreeUnicodeString(&stale_filename);
- + status = STATUS_SUCCESS;
- + }
- +
- + DbgP("nfs41_set_stale: DONE\n");
- +#if 0
- + } __except(EXCEPTION_EXECUTE_HANDLER) {
- + NTSTATUS code;
- + code = GetExceptionCode();
- + print_error("nfs41_set_stale: srv_open=0x%p '%wZ': "
- + "exception 0x%lx\n",
- + srv_open,
- + srv_open->pAlreadyPrefixedName,
- + (long)code);
- + status = STATUS_INTERNAL_ERROR;
- + }
- +#endif
- +
- + return status;
- +}
- +
- NTSTATUS nfs41_shutdown_daemon(
- DWORD version)
- {
- @@ -639,6 +716,9 @@ NTSTATUS nfs41_DevFcbXXXControlFile(
- case IOCTL_NFS41_INVALCACHE:
- status = nfs41_invalidate_cache(RxContext);
- break;
- + case IOCTL_NFS41_SET_STALE:
- + status = nfs41_set_stale(RxContext);
- + break;
- case IOCTL_NFS41_READ:
- status = nfs41_upcall(RxContext);
- break;
- @@ -988,6 +1068,21 @@ NTSTATUS nfs41_IsValidDirectory (
- return STATUS_SUCCESS;
- }
- +void nfs41_MungeBufferingIfWriteOnlyHandles(
- + PMRX_SRV_OPEN srvopen,
- + ULONG writeonly_srvopen_count)
- +{
- + if (writeonly_srvopen_count != 0) {
- + srvopen->BufferingFlags &=
- + ~(FCB_STATE_WRITECACHING_ENABLED |
- + FCB_STATE_FILESIZECACHEING_ENABLED |
- + FCB_STATE_FILETIMECACHEING_ENABLED |
- + FCB_STATE_LOCK_BUFFERING_ENABLED |
- + FCB_STATE_READCACHING_ENABLED |
- + FCB_STATE_COLLAPSING_ENABLED);
- + }
- +}
- +
- NTSTATUS nfs41_ComputeNewBufferingState(
- IN OUT PMRX_SRV_OPEN pSrvOpen,
- IN PVOID pMRxContext,
- @@ -998,6 +1093,7 @@ NTSTATUS nfs41_ComputeNewBufferingState(
- #ifdef DEBUG_TIME_BASED_COHERENCY
- ULONG oldFlags = pSrvOpen->BufferingFlags;
- #endif
- + PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(pSrvOpen->pFcb);
- switch(flag) {
- case DISABLE_CACHING:
- @@ -1031,6 +1127,9 @@ NTSTATUS nfs41_ComputeNewBufferingState(
- break;
- }
- + nfs41_MungeBufferingIfWriteOnlyHandles(pSrvOpen,
- + nfs41_fcb->writeonly_srvopen_count);
- +
- #ifdef DEBUG_TIME_BASED_COHERENCY
- DbgP("nfs41_ComputeNewBufferingState: '%wZ' pSrvOpen 0x%p Old %08x New %08x\n",
- pSrvOpen->pAlreadyPrefixedName, pSrvOpen, oldFlags,
- diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
- index 441d8f7..a43d002 100644
- --- a/sys/nfs41sys_driver.h
- +++ b/sys/nfs41sys_driver.h
- @@ -276,6 +276,9 @@ typedef struct _updowncall_entry {
- FILE_INFORMATION_CLASS InfoClass;
- PVOID buf;
- ULONG buf_len;
- + BOOLEAN rename_stale_dst_path_overwritten;
- + USHORT rename_stale_dst_path_len;
- + const void *rename_stale_dst_path_buf;
- } SetFile;
- struct {
- DWORD mode;
- @@ -488,7 +491,9 @@ typedef struct _NFS41_FCB {
- ULONGLONG fsid_major, fsid_minor;
- BOOLEAN Renamed;
- BOOLEAN DeletePending;
- + BOOLEAN stale;
- DWORD mode;
- + LONG writeonly_srvopen_count;
- #ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
- DWORD owner_local_uid; /* owner mapped into local uid */
- DWORD owner_group_local_gid; /* owner group mapped into local gid */
- @@ -507,6 +512,7 @@ typedef struct _NFS41_FCB {
- typedef struct _NFS41_SRV_OPEN {
- BOOLEAN initialised;
- + BOOLEAN writeonly_srvopen;
- /*
- * |sec_ctx| must be per |SRV_OPEN| to handle newgrp()/|setgid()|
- * support. But this only works if we prevent |SRV_OPEN| collapsing
- @@ -721,6 +727,9 @@ void enable_caching(
- VOID nfs41_update_fcb_list(
- PMRX_FCB fcb,
- ULONGLONG ChangeTime);
- +void nfs41_MungeBufferingIfWriteOnlyHandles(
- + PMRX_SRV_OPEN srvopen,
- + ULONG writeonly_srvopen_count);
- /* nfs41sys_ea.c */
- NTSTATUS marshal_nfs41_easet(
- @@ -975,15 +984,21 @@ NTSTATUS marshal_nfs41_fileset(
- unsigned char *buf,
- ULONG buf_len,
- ULONG *len);
- -void unmarshal_nfs41_setattr(
- +void unmarshal_nfs41_getchangetime(
- nfs41_updowncall_entry *cur,
- PULONGLONG dest_buf,
- const unsigned char *restrict *restrict buf);
- +void unmarshal_nfs41_setattr(
- + nfs41_updowncall_entry *cur,
- + const unsigned char *restrict *restrict buf);
- void unmarshal_nfs41_getattr(
- nfs41_updowncall_entry *cur,
- const unsigned char *restrict *restrict buf);
- NTSTATUS nfs41_QueryFileInformation(
- IN OUT PRX_CONTEXT RxContext);
- +VOID nfs41_mark_file_as_non_collapsible(
- + PNET_ROOT netroot,
- + PUNICODE_STRING nonc_filename);
- NTSTATUS nfs41_SetFileInformation(
- IN OUT PRX_CONTEXT RxContext);
- NTSTATUS nfs41_SetFileInformationAtCleanup(
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index b7ef8ec..a1ea0dd 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -160,8 +160,14 @@ NTSTATUS marshal_nfs41_fileset(
- }
- #endif /* NFS41_DRIVER_STOMP_CYGWIN_SILLYRENAME_INVALID_UTF16_SEQUENCE_SUPPORT */
- + /*
- + * We use %lu here for |ReplaceIfExists| because of
- + * |FileRenameInformationEx| uses a ULONG flags field
- + */
- DbgP("marshal_nfs41_fileset: "
- - "FILE_RENAME_INFORMATION.(FileNameLength=%d FileName='%.*ls')\n",
- + "FILE_RENAME_INFORMATION."
- + "(ReplaceIfExists=%lu FileNameLength=%d FileName='%.*ls')\n",
- + (unsigned long)fri->ReplaceIfExists,
- (int)fri->FileNameLength,
- (int)(fri->FileNameLength/sizeof(wchar_t)), fri->FileName);
- }
- @@ -205,7 +211,7 @@ out:
- return status;
- }
- -void unmarshal_nfs41_setattr(
- +void unmarshal_nfs41_getchangetime(
- nfs41_updowncall_entry *cur,
- PULONGLONG dest_buf,
- const unsigned char *restrict *restrict buf)
- @@ -213,10 +219,38 @@ void unmarshal_nfs41_setattr(
- RtlCopyMemory(dest_buf, *buf, sizeof(*dest_buf));
- *buf += sizeof(*dest_buf);
- #ifdef DEBUG_MARSHAL_DETAIL
- - DbgP("unmarshal_nfs41_setattr: returned ChangeTime %llu\n", *dest_buf);
- + DbgP("unmarshal_nfs41_getchangetime: returned ChangeTime %llu\n", *dest_buf);
- #endif
- }
- +void unmarshal_nfs41_setattr(
- + nfs41_updowncall_entry *cur,
- + const unsigned char *restrict *restrict buf)
- +{
- + RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(cur->ChangeTime));
- + *buf += sizeof(cur->ChangeTime);
- +
- + if (cur->u.SetFile.InfoClass == FileRenameInformation) {
- + RtlCopyMemory(&cur->u.SetFile.rename_stale_dst_path_overwritten,
- + *buf, sizeof(cur->u.SetFile.rename_stale_dst_path_overwritten));
- + *buf += sizeof(cur->u.SetFile.rename_stale_dst_path_overwritten);
- +
- + if (cur->u.SetFile.rename_stale_dst_path_overwritten) {
- + RtlCopyMemory(&cur->u.SetFile.rename_stale_dst_path_len,
- + *buf, sizeof(cur->u.SetFile.rename_stale_dst_path_len));
- + *buf += sizeof(cur->u.SetFile.rename_stale_dst_path_len);
- +
- + cur->u.SetFile.rename_stale_dst_path_buf = *buf;
- + *buf += cur->u.SetFile.rename_stale_dst_path_len;
- +
- + if (((char *)cur->u.SetFile.rename_stale_dst_path_buf)[cur->u.SetFile.rename_stale_dst_path_len-1] == '\0') {
- + DbgP("unmarshal_nfs41_setattr: fixing rename_stale_dst_path_len\n");
- + cur->u.SetFile.rename_stale_dst_path_len--;
- + }
- + }
- + }
- +}
- +
- void unmarshal_nfs41_getattr(
- nfs41_updowncall_entry *cur,
- const unsigned char *restrict *restrict buf)
- @@ -737,6 +771,68 @@ out:
- return status;
- }
- +VOID nfs41_mark_file_as_non_collapsible(
- + PNET_ROOT netroot,
- + PUNICODE_STRING nonc_filename)
- +{
- + PFCB fcb;
- +// bool is_locked;
- +
- + DbgP("nfs41_mark_file_as_non_collapsible: "
- + "argument filename='%wZ'\n",
- + nonc_filename);
- +#if 0
- + is_locked = RxIsFcbTableLockAcquired(&netroot->FcbTable);
- +
- + DbgP("nfs41_mark_file_as_non_collapsible: "
- + "is_locked=%dm shared=%ld, exclusive=%ld\n", (int)is_locked,
- + (long)ExIsResourceAcquiredSharedLite(&netroot->FcbTable.TableLock),
- + (long)ExIsResourceAcquiredExclusiveLite(&netroot->FcbTable.TableLock));
- +#endif
- +
- +#if 1
- + RxAcquireFcbTableLockExclusive(&netroot->FcbTable, TRUE);
- +#else
- +// RxAcquireFcbTableLockShared(&netroot->FcbTable, TRUE);
- + if (is_locked == false)
- + RxAcquireFcbTableLockExclusive(&netroot->FcbTable, TRUE);
- +#endif
- + DbgP("nfs41_mark_file_as_non_collapsible: #mark X1\n");
- +
- + fcb = RxFcbTableLookupFcb(&netroot->FcbTable, nonc_filename);
- +
- + DbgP("nfs41_mark_file_as_non_collapsible: #mark X2, fcb=0x%p\n",
- + (void *)fcb);
- +
- +#if 1
- + RxReleaseFcbTableLock(&netroot->FcbTable);
- +#else
- + if (is_locked == false)
- + RxReleaseFcbTableLock(&netroot->FcbTable);
- +#endif
- +
- + DbgP("nfs41_mark_file_as_non_collapsible: #mark X3\n");
- +
- + if (fcb) {
- + PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(fcb);
- +
- + DbgP("nfs41_mark_file_as_non_collapsible: #mark X4\n");
- +
- + nfs41_fcb->stale = TRUE;
- +
- + RxpDereferenceNetFcb(fcb);
- +
- + DbgP("nfs41_mark_file_as_non_collapsible: "
- + "marking filename='%wZ' as stale\n",
- + nonc_filename);
- + }
- + else {
- + DbgP("nfs41_mark_file_as_non_collapsible: "
- + "nothing found for filename='%wZ'\n",
- + nonc_filename);
- + }
- +}
- +
- static
- NTSTATUS nfs41_SetFileInformationImpl(
- IN OUT PRX_CONTEXT RxContext,
- @@ -765,7 +861,7 @@ NTSTATUS nfs41_SetFileInformationImpl(
- DbgEn();
- print_debug_filedirquery_header(RxContext);
- #endif
- - FsRtlEnterFileSystem();
- +// FsRtlEnterFileSystem();
- status = check_nfs41_setattr_args(RxContext);
- if (status) goto out;
- @@ -858,6 +954,8 @@ NTSTATUS nfs41_SetFileInformationImpl(
- status = STATUS_SUCCESS;
- goto out;
- }
- +
- + (void)RxFlushFcbInSystemCache((PFCB)RxContext->pFcb, TRUE);
- }
- }
- @@ -902,6 +1000,68 @@ NTSTATUS nfs41_SetFileInformationImpl(
- (FILE_READ_DATA | FILE_WRITE_DATA | FILE_APPEND_DATA)))
- nfs41_update_fcb_list(RxContext->pFcb, entry->ChangeTime);
- nfs41_fcb->changeattr = entry->ChangeTime;
- +
- +#if 1
- + if (RxContext->Info.FileInformationClass == FileRenameInformation) {
- + DbgP("marshal_nfs41_fileset: "
- + "finishig FileRenameInformation for filename='%wZ', "
- + "rename_stale_dst_path_overwritten=%d\n",
- + entry->filename,
- + (int)entry->u.SetFile.rename_stale_dst_path_overwritten);
- +
- + if (entry->u.SetFile.rename_stale_dst_path_overwritten) {
- + DbgP("nfs41_set_stale: rename_stale_dst_path_len=%d inbuf='%.*s'\n",
- + (int)entry->u.SetFile.rename_stale_dst_path_len,
- + (int)entry->u.SetFile.rename_stale_dst_path_len,
- + entry->u.SetFile.rename_stale_dst_path_buf);
- + UTF8_STRING stale_utf8filename = {
- + .Length = (USHORT)entry->u.SetFile.rename_stale_dst_path_len,
- + .MaximumLength = (USHORT)entry->u.SetFile.rename_stale_dst_path_len,
- + .Buffer = (PCHAR)entry->u.SetFile.rename_stale_dst_path_buf
- + };
- +
- + DbgP("marshal_nfs41_fileset/stale: #mark4\n");
- +
- + UNICODE_STRING stale_filename;
- +
- + status = RtlUTF8StringToUnicodeString(&stale_filename,
- + &stale_utf8filename, TRUE);
- + if (NT_SUCCESS(status)) {
- + DbgP("marshal_nfs41_fileset/stale: stale_filename='%wZ'\n",
- + &stale_filename);
- +#if 1
- + nfs41_mark_file_as_non_collapsible(
- + (PNET_ROOT)SrvOpen->pVNetRoot->pNetRoot,
- + &stale_filename);
- +#endif
- + RtlFreeUnicodeString(&stale_filename);
- + status = STATUS_SUCCESS;
- + }
- +
- + DbgP("marshal_nfs41_fileset/stale: DONE\n");
- + }
- + }
- +#endif
- +#if 0 /* old */
- + if (RxContext->Info.FileInformationClass == FileRenameInformation) {
- + DbgP("marshal_nfs41_fileset: "
- + "setting SRVOPEN_FLAG_FILE_RENAMED for filename='%wZ'\n",
- + entry->filename);
- + SetFlag(SrvOpen->Flags, SRVOPEN_FLAG_FILE_RENAMED);
- +
- + PFILE_RENAME_INFORMATION prinfo =
- + (PFILE_RENAME_INFORMATION)RxContext->Info.Buffer;
- + UNICODE_STRING ren_dst = {
- + .Length = (USHORT)prinfo->FileNameLength,
- + .MaximumLength = (USHORT)prinfo->FileNameLength,
- + .Buffer = prinfo->FileName
- + };
- + nfs41_mark_file_as_non_collapsible((PNET_ROOT)SrvOpen->pVNetRoot->pNetRoot, &ren_dst);
- + DbgP("marshal_nfs41_fileset: "
- + "DONE setting SRVOPEN_FLAG_FILE_RENAMED for filename='%wZ'\n",
- + entry->filename);
- + }
- +#endif
- }
- out:
- if (entry) {
- @@ -916,7 +1076,7 @@ out:
- t2.QuadPart - t1.QuadPart, setattr.tops, setattr.ticks);
- #endif
- #endif
- - FsRtlExitFileSystem();
- +// FsRtlExitFileSystem();
- #ifdef DEBUG_FILE_SET
- DbgEx();
- #endif
- diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
- index ba2effa..502182a 100644
- --- a/sys/nfs41sys_mount.c
- +++ b/sys/nfs41sys_mount.c
- @@ -943,6 +943,8 @@ NTSTATUS nfs41_CreateVNetRoot(
- goto out;
- }
- + ((PNET_ROOT)pNetRoot)->FcbTable.CaseInsensitiveMatch = FALSE;
- +
- pVNetRootContext->session = INVALID_HANDLE_VALUE;
- /*
- diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
- index eaf04f0..cddaab8 100644
- --- a/sys/nfs41sys_openclose.c
- +++ b/sys/nfs41sys_openclose.c
- @@ -1229,6 +1229,7 @@ retry_on_link:
- DbgP("nfs41_Create: write-only handle for file '%wZ', "
- "setting SRVOPEN_FLAG_DONTUSE_WRITE_CACHING\n",
- SrvOpen->pAlreadyPrefixedName);
- + nfs41_srvopen->writeonly_srvopen = TRUE;
- }
- if (!(params->CreateOptions & FILE_WRITE_THROUGH) &&
- @@ -1321,6 +1322,14 @@ out:
- nfs41_srvopen->sec_ctx.ClientToken = NULL;
- }
- }
- + else {
- + /* Success! */
- + if (nfs41_srvopen->writeonly_srvopen)
- + nfs41_fcb->writeonly_srvopen_count++;
- +
- + nfs41_MungeBufferingIfWriteOnlyHandles(SrvOpen,
- + nfs41_fcb->writeonly_srvopen_count);
- + }
- if (fcb_locked_exclusive) {
- RxReleaseFcbResourceInMRx(Fcb);
- @@ -1385,6 +1394,28 @@ NTSTATUS nfs41_ShouldTryToCollapseThisOpen(
- goto out;
- }
- + if (nfs41_fcb->Renamed) {
- + DbgP("nfs41_ShouldTryToCollapseThisOpen: filename='%wZ' nfs41_fcb->Renamed set, cannot collapse\n",
- + SrvOpen->pAlreadyPrefixedName);
- + status = STATUS_MORE_PROCESSING_REQUIRED;
- + goto out;
- + }
- +
- + if (nfs41_fcb->stale) {
- + DbgP("nfs41_ShouldTryToCollapseThisOpen: filename='%wZ' nfs41_fcb->stale set, cannot collapse\n",
- + SrvOpen->pAlreadyPrefixedName);
- + status = STATUS_MORE_PROCESSING_REQUIRED;
- + goto out;
- + }
- +
- + if (BooleanFlagOn(SrvOpen->Flags, SRVOPEN_FLAG_FILE_RENAMED)) {
- + DbgP("nfs41_ShouldTryToCollapseThisOpen: filename='%wZ' renamed, cannot collapse\n",
- + SrvOpen->pAlreadyPrefixedName);
- + status = STATUS_MORE_PROCESSING_REQUIRED;
- + goto out;
- + }
- +
- +
- #ifdef WINBUG_NO_COLLAPSE_IF_PRIMARYGROUPS_DIFFER
- /*
- * Reject srvopens if the primary group used to create
- @@ -1643,6 +1674,13 @@ NTSTATUS nfs41_CloseSrvOpen(
- status = map_close_errors(entry->status);
- out:
- + if (status == 0) {
- + /* Success! */
- +
- + if (nfs41_srvopen->writeonly_srvopen)
- + nfs41_fcb->writeonly_srvopen_count--;
- + }
- +
- if (entry) {
- nfs41_UpcallDestroy(entry);
- }
- diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
- index 15f948c..3c5ea62 100644
- --- a/sys/nfs41sys_updowncall.c
- +++ b/sys/nfs41sys_updowncall.c
- @@ -773,13 +773,13 @@ NTSTATUS nfs41_downcall(
- break;
- case NFS41_SYSOP_FILE_SET:
- case NFS41_SYSOP_FILE_SET_AT_CLEANUP:
- - unmarshal_nfs41_setattr(cur, &cur->ChangeTime, &inbuf);
- + unmarshal_nfs41_setattr(cur, &inbuf);
- break;
- case NFS41_SYSOP_EA_SET:
- - unmarshal_nfs41_setattr(cur, &cur->ChangeTime, &inbuf);
- + unmarshal_nfs41_getchangetime(cur, &cur->ChangeTime, &inbuf);
- break;
- case NFS41_SYSOP_ACL_SET:
- - unmarshal_nfs41_setattr(cur, &cur->ChangeTime, &inbuf);
- + unmarshal_nfs41_getchangetime(cur, &cur->ChangeTime, &inbuf);
- break;
- case NFS41_SYSOP_FSCTL_QUERYALLOCATEDRANGES:
- unmarshal_nfs41_queryallocatedranges(cur, &inbuf);
nfs41_writeonly_experiments20260218.diff
Posted by Anonymous on Wed 18th Feb 2026 16:25
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.
nrubsig.kpaste.net RSS