- From 7212716b0022f72710072b19d87d5ca7afd2afab Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 4 Dec 2025 14:19:57 +0100
- Subject: [PATCH] sys:
- |FSCTL_SET_ZERO_DATA|,|FSCTL_DUPLICATE_EXTENTS_TO_FILE|,|FSCTL_OFFLOAD_WRITE|
- should purge cache data
- |FSCTL_SET_ZERO_DATA|,|FSCTL_DUPLICATE_EXTENTS_TO_FILE|,|FSCTL_OFFLOAD_WRITE|
- should flush+purge filesystem cache data of the destination file, to
- make sure that a read after the FSCTL reads the data from
- the server.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_fsctl.c | 34 +++++++++++++++++-----------------
- 1 file changed, 17 insertions(+), 17 deletions(-)
- diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
- index 686b139..d39544f 100644
- --- a/sys/nfs41sys_fsctl.c
- +++ b/sys/nfs41sys_fsctl.c
- @@ -500,12 +500,12 @@ NTSTATUS nfs41_SetZeroData(
- /*
- * NFSv4.2 DEALLOCATE is basically a "write" operation, but happens
- * only on the NFS server side. We need to flush our NFS client
- - * cache and wait for the kernel lazy writer before doing the
- - * DEALLOCATE, to avoid that we have outstanding writes in the
- - * kernel cache at the same location where the DEALLOCATE should
- - * do it's work.
- + * cache, wait for the kernel lazy writer and purge the cache map
- + * before doing the DEALLOCATE, to avoid that we have outstanding
- + * writes in the kernel cache at the same location where the
- + * DEALLOCATE should do it's work.
- */
- - (void)RxFlushFcbInSystemCache((PFCB)RxContext->pFcb, TRUE);
- + (void)RxPurgeFcbInSystemCache((PFCB)RxContext->pFcb, NULL, 0L, TRUE, TRUE);
- status = nfs41_UpcallCreate(NFS41_SYSOP_FSCTL_SET_ZERO_DATA,
- &nfs41_fobx->sec_ctx,
- @@ -804,18 +804,18 @@ NTSTATUS nfs41_DuplicateData(
- /*
- * NFSv4.2 CLONE is basically a "write" operation, but happens
- * only on the NFS server side. We need to flush our NFS client
- - * cache (for both src and dest files!!) and wait in both cases
- - * for the kernel lazy writer before doing the CLONE, to avoid
- - * that we have outstanding writes in the kernel cache at the
- - * same location where the CLONE should do it's work.
- + * cache for the src file, flush+purge the dest file, and wait
- + * in both cases for the kernel lazy writer before doing the CLONE,
- + * to avoid that we have outstanding writes in the kernel cache at
- + * the same location where the CLONE should do it's work.
- */
- DbgP("nfs41_DuplicateData: flushing src file '%wZ'\n",
- srcfox->SrvOpen->pAlreadyPrefixedName);
- (void)RxFlushFcbInSystemCache((PFCB)srcfcb, TRUE);
- - DbgP("nfs41_DuplicateData: flushing dest file '%wZ'\n",
- + DbgP("nfs41_DuplicateData: flush+purge dest file '%wZ'\n",
- RxContext->pRelevantSrvOpen->pAlreadyPrefixedName);
- - (void)RxFlushFcbInSystemCache((PFCB)RxContext->pFcb, TRUE);
- + (void)RxPurgeFcbInSystemCache((PFCB)RxContext->pFcb, NULL, 0L, TRUE, TRUE);
- status = nfs41_UpcallCreate(NFS41_SYSOP_FSCTL_DUPLICATE_DATA,
- &nfs41_fobx->sec_ctx,
- @@ -1338,18 +1338,18 @@ NTSTATUS nfs41_OffloadWrite(
- /*
- * NFSv4.2 COPY is basically a "write" operation, but happens
- * only on the NFS server side. We need to flush our NFS client
- - * cache (for both src and dest files!!) and wait in both cases
- - * for the kernel lazy writer before doing the COPY, to avoid
- - * that we have outstanding writes in the kernel cache at the
- - * same location where the COPY should do it's work.
- + * cache for the src file, flush+purge the dest file, and wait
- + * in both cases for the kernel lazy writer before doing the COPY,
- + * to avoid that we have outstanding writes in the kernel cache at
- + * the same location where the COPY should do it's work.
- */
- DbgP("nfs41_OffloadWrite: flushing src file '%wZ'\n",
- src_oce->src_srvopen->pAlreadyPrefixedName);
- (void)RxFlushFcbInSystemCache((PFCB)src_oce->src_srvopen->pFcb, TRUE);
- - DbgP("nfs41_OffloadWrite: flushing dest file '%wZ'\n",
- + DbgP("nfs41_OffloadWrite: flush+purge dest file '%wZ'\n",
- RxContext->pRelevantSrvOpen->pAlreadyPrefixedName);
- - (void)RxFlushFcbInSystemCache((PFCB)RxContext->pFcb, TRUE);
- + (void)RxPurgeFcbInSystemCache((PFCB)RxContext->pFcb, NULL, 0L, TRUE, TRUE);
- status = nfs41_UpcallCreate(NFS41_SYSOP_FSCTL_OFFLOAD_DATACOPY,
- &nfs41_fobx->sec_ctx,
- --
- 2.51.0
msnfs41client: Patch to flush+purge fs cache data of dest file for FSCTL operations, 2025-12-04
Posted by Anonymous on Tue 9th Dec 2025 19:39
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.
rovema.kpaste.net RSS