- From e1cb1991270655e7c524a254620eea773f00931e Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sat, 1 Mar 2025 14:40:59 +0100
- Subject: [PATCH 1/2] daemon: Fix regression in |handle_getacl()| when
- owner||owner_group is not cached
- Fix regression in |handle_getacl()| when owner||owner_group is not cached.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/acl.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
- diff --git a/daemon/acl.c b/daemon/acl.c
- index dbfa975..c098ba7 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -368,8 +368,10 @@ use_nfs41_getattr:
- * (usually for new files). In this case do a full
- * roundtrip to the NFS server to get the data...
- */
- - if (bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_OWNER) &&
- - bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_OWNER_GROUP)) {
- + if ((bitmap_isset(&info.attrmask, 1,
- + FATTR4_WORD1_OWNER) == false) ||
- + (bitmap_isset(&info.attrmask, 1,
- + FATTR4_WORD1_OWNER_GROUP) == false)) {
- DPRINTF(ACLLVL2, ("handle_getattr: owner/owner_group not in cache, doing full lookup...\n"));
- goto use_nfs41_getattr;
- }
- --
- 2.45.1
- From 1e2ac2b3fe6b0eb0b163d7190be3c9a6862deac7 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sat, 1 Mar 2025 14:59:54 +0100
- Subject: [PATCH 2/2] daemon,include,sys,tests: Implement |FileIdInformation|
- for PortableGit
- Implement |FileIdInformation|, used by PortableGit.
- Reported-by: Josh Hurst <joshhurst@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/getattr.c | 15 +++++++++
- daemon/upcall.h | 1 +
- include/from_kernel.h | 5 +++
- sys/nfs41sys_fileinfo.c | 2 ++
- tests/winfsinfo1/winfsinfo.c | 59 ++++++++++++++++++++++++++++++++++++
- 5 files changed, 82 insertions(+)
- diff --git a/daemon/getattr.c b/daemon/getattr.c
- index c3c8741..0eb7869 100644
- --- a/daemon/getattr.c
- +++ b/daemon/getattr.c
- @@ -218,6 +218,14 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
- nfs_to_remote_protocol_info(state,
- &args->remote_protocol_info);
- break;
- + case FileIdInformation:
- + uint64_t fileid128[2] = {
- + (info.fsid.minor ^ info.fsid.major),
- + info.fileid
- + };
- + args->id_info.VolumeSerialNumber = 0xBABAFACE; /* 64bit! */
- + (void)memcpy(&args->id_info.FileId, &fileid128[0], 16);
- + break;
- #ifdef NFS41_DRIVER_WSL_SUPPORT
- case FileStatInformation:
- nfs_to_stat_info(state->file.name.name,
- @@ -295,6 +303,13 @@ static int marshall_getattr(unsigned char *buffer, uint32_t *length, nfs41_upcal
- &args->remote_protocol_info, info_len);
- if (status) goto out;
- break;
- + case FileIdInformation:
- + info_len = sizeof(args->id_info);
- + status = safe_write(&buffer, length, &info_len, sizeof(info_len));
- + if (status) goto out;
- + status = safe_write(&buffer, length, &args->id_info, info_len);
- + if (status) goto out;
- + break;
- #ifdef NFS41_DRIVER_WSL_SUPPORT
- case FileStatInformation:
- info_len = sizeof(args->stat_info);
- diff --git a/daemon/upcall.h b/daemon/upcall.h
- index abf53ad..19e36f8 100644
- --- a/daemon/upcall.h
- +++ b/daemon/upcall.h
- @@ -107,6 +107,7 @@ typedef struct __getattr_upcall_args {
- FILE_INTERNAL_INFORMATION intr_info;
- FILE_NETWORK_OPEN_INFORMATION network_info;
- FILE_REMOTE_PROTOCOL_INFORMATION remote_protocol_info;
- + FILE_ID_INFORMATION id_info;
- #ifdef NFS41_DRIVER_WSL_SUPPORT
- FILE_STAT_INFORMATION stat_info;
- FILE_STAT_LX_INFORMATION stat_lx_info;
- diff --git a/include/from_kernel.h b/include/from_kernel.h
- index 962ceef..753f31c 100644
- --- a/include/from_kernel.h
- +++ b/include/from_kernel.h
- @@ -440,6 +440,11 @@ typedef struct _FILE_INTERNAL_INFORMATION {
- LARGE_INTEGER IndexNumber;
- } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
- +typedef struct _FILE_ID_INFORMATION {
- + ULONGLONG VolumeSerialNumber;
- + FILE_ID_128 FileId;
- +} FILE_ID_INFORMATION, *PFILE_ID_INFORMATION;
- +
- /*
- * |FILE_ALLOCATED_RANGE_BUFFER| - test for
- * /usr/i686-w64-mingw32/sys-root/mingw/include/winioctl.h header
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index c8ae273..07bb770 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -336,6 +336,7 @@ NTSTATUS nfs41_QueryFileInformation(
- case FileAttributeTagInformation:
- case FileNetworkOpenInformation:
- case FileRemoteProtocolInformation:
- + case FileIdInformation:
- #ifdef NFS41_DRIVER_WSL_SUPPORT
- case FileStatInformation:
- case FileStatLxInformation:
- @@ -432,6 +433,7 @@ NTSTATUS nfs41_QueryFileInformation(
- break;
- case FileNetworkOpenInformation:
- case FileRemoteProtocolInformation:
- + case FileIdInformation:
- case FileInternalInformation:
- case FileAttributeTagInformation:
- #ifdef NFS41_DRIVER_WSL_SUPPORT
- diff --git a/tests/winfsinfo1/winfsinfo.c b/tests/winfsinfo1/winfsinfo.c
- index 6415476..77cc036 100644
- --- a/tests/winfsinfo1/winfsinfo.c
- +++ b/tests/winfsinfo1/winfsinfo.c
- @@ -981,6 +981,61 @@ done:
- return res;
- }
- +static
- +bool get_fileidinfo(const char *progname, const char *filename)
- +{
- + int res = EXIT_FAILURE;
- + bool ok;
- + FILE_ID_INFO idinfo;
- + (void)memset(&idinfo, 0, sizeof(idinfo));
- +
- + HANDLE fileHandle = CreateFileA(filename,
- + GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
- + FILE_FLAG_BACKUP_SEMANTICS, NULL);
- + if (fileHandle == INVALID_HANDLE_VALUE) {
- + (void)fprintf(stderr,
- + "%s: Error opening file '%s'. Last error was %d.\n",
- + progname,
- + filename,
- + (int)GetLastError());
- + return EXIT_FAILURE;
- + }
- +
- + ok = GetFileInformationByHandleEx(fileHandle,
- + FileIdInfo,
- + &idinfo, sizeof(idinfo));
- +
- + if (!ok) {
- + (void)fprintf(stderr, "%s: GetFileInformationByHandleEx() "
- + "error. GetLastError()==%d.\n",
- + progname,
- + (int)GetLastError());
- + res = EXIT_FAILURE;
- + goto done;
- + }
- +
- + (void)printf("(\n");
- + (void)printf("\tfilename='%s'\n", filename);
- +
- + (void)printf("\tVolumeSerialNumber=0x%llx\n",
- + idinfo.VolumeSerialNumber);
- + (void)printf("\ttypeset -a FileId=(\n");
- + int i;
- + for (i=0 ; i < 16 ; i++) {
- + (void)printf("\t\t[%d]=0x%02.2x\n",
- + i,
- + (int)idinfo.FileId.Identifier[i]);
- + }
- + (void)printf("\t)\n");
- +
- + (void)printf(")\n");
- + res = EXIT_SUCCESS;
- +
- +done:
- + (void)CloseHandle(fileHandle);
- + return res;
- +}
- +
- static
- int fsctlqueryallocatedranges(const char *progname, const char *filename)
- {
- @@ -1152,6 +1207,7 @@ void usage(void)
- "getfiletime|"
- "nfs3attr|"
- "fileremoteprotocolinfo|"
- + "fileidinfo|"
- "fsctlqueryallocatedranges"
- "> path\n");
- }
- @@ -1211,6 +1267,9 @@ int main(int ac, char *av[])
- else if (!strcmp(subcmd, "fileremoteprotocolinfo")) {
- return get_file_remote_protocol_info(av[0], av[2]);
- }
- + else if (!strcmp(subcmd, "fileidinfo")) {
- + return get_fileidinfo(av[0], av[2]);
- + }
- else if (!strcmp(subcmd, "fsctlqueryallocatedranges")) {
- return fsctlqueryallocatedranges(av[0], av[2]);
- }
- --
- 2.45.1
msnfs41client: Patches for |FileIdInformation| implementation+fix ACL regression, 2025-03-01
Posted by Anonymous on Sat 1st Mar 2025 14:09
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.