- From 1c83d20c6a7acea88b000f91ee16dd46efd84470 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 17 Feb 2025 12:52:29 +0100
- Subject: [PATCH 1/8] daemon,sys: Add support for |FATTR4_WORD1_SPACE_USED|
- Add support for |FATTR4_WORD1_SPACE_USED| (number of file system
- bytes allocated to this filesystem object), which is mapped to
- Win32 |FILE_STANDARD_INFORMATION.AllocationSize|.
- This is required to track the allocated size for sparse files.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/callback_xdr.c | 7 +++++--
- daemon/daemon_debug.c | 3 +++
- daemon/fileinfoutil.c | 22 ++++++++++++++--------
- daemon/lookup.c | 6 ++++--
- daemon/name_cache.c | 33 ++++++++++++++++++++++-----------
- daemon/nfs41_ops.c | 6 ++++--
- daemon/nfs41_superblock.c | 3 ++-
- daemon/nfs41_types.h | 4 +++-
- daemon/nfs41_xdr.c | 4 ++++
- daemon/readdir.c | 9 +++++----
- daemon/setattr.c | 12 +++++++++++-
- sys/nfs41sys_ea.c | 10 ++++++----
- sys/nfs41sys_fileinfo.c | 11 +----------
- 13 files changed, 84 insertions(+), 46 deletions(-)
- diff --git a/daemon/callback_xdr.c b/daemon/callback_xdr.c
- index 99333c5..8a21e40 100644
- --- a/daemon/callback_xdr.c
- +++ b/daemon/callback_xdr.c
- @@ -1,5 +1,6 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -265,7 +266,9 @@ static bool_t info_to_fattr4(nfs41_file_info *info, fattr4 *fattr)
- NFS4_OPAQUE_LIMIT, XDR_ENCODE);
- /* The only attributes that the server can reliably
- - * query via CB_GETATTR are size and change. */
- + * query via CB_GETATTR are size and change.
- + * FIXME: What about |FATTR4_WORD1_SPACE_USED| ?
- + */
- if (bitmap_isset(&info->attrmask, 0, FATTR4_WORD0_CHANGE)) {
- result = xdr_u_hyper(&fattr_xdr, &info->change);
- if (!result) { CBX_ERR("getattr.info.change"); goto out; }
- diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
- index 4f3a9f2..493d221 100644
- --- a/daemon/daemon_debug.c
- +++ b/daemon/daemon_debug.c
- @@ -1111,6 +1111,9 @@ void print_nfs41_file_info(
- (long)info->time_modify.seconds,
- (long)info->time_modify.nseconds);
- }
- + if (info->attrmask.arr[1] & FATTR4_WORD1_SPACE_USED)
- + PRNFS41FI_FMT("space_used=%lld, ",
- + (long long)info->space_used);
- if (info->attrmask.arr[1] & FATTR4_WORD1_SYSTEM)
- PRNFS41FI_FMT("system=%d, ", (int)info->system);
- p += snprintf(p, (sizeof(buf)-(p-buf)), "} ");
- diff --git a/daemon/fileinfoutil.c b/daemon/fileinfoutil.c
- index 97eff4f..bb23b41 100644
- --- a/daemon/fileinfoutil.c
- +++ b/daemon/fileinfoutil.c
- @@ -140,9 +140,11 @@ void nfs_to_standard_info(
- EASSERT(info->attrmask.arr[0] & FATTR4_WORD0_SIZE);
- EASSERT((info->attrmask.count > 0) &&
- (info->attrmask.arr[1] & FATTR4_WORD1_NUMLINKS));
- + EASSERT((info->attrmask.count > 0) &&
- + (info->attrmask.arr[1] & FATTR4_WORD1_SPACE_USED));
- - std_out->AllocationSize.QuadPart =
- - std_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + std_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + std_out->AllocationSize.QuadPart = (LONGLONG)info->space_used;
- std_out->NumberOfLinks = info->numlinks;
- std_out->DeletePending = FALSE;
- std_out->Directory = FileAttributes & FILE_ATTRIBUTE_DIRECTORY ?
- @@ -194,8 +196,8 @@ void nfs_to_network_openinfo(
- net_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- }
- - net_out->AllocationSize.QuadPart =
- - net_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + net_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + net_out->AllocationSize.QuadPart = (LONGLONG)info->space_used;
- net_out->FileAttributes =
- nfs_file_info_to_attributes(superblock, info);
- }
- @@ -272,8 +274,8 @@ void nfs_to_stat_info(
- stat_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- }
- - stat_out->AllocationSize.QuadPart =
- - stat_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + stat_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + stat_out->AllocationSize.QuadPart = (LONGLONG)info->space_used;
- stat_out->FileAttributes =
- nfs_file_info_to_attributes(superblock, info);
- @@ -340,8 +342,8 @@ void nfs_to_stat_lx_info(
- stat_lx_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- }
- - stat_lx_out->AllocationSize.QuadPart =
- - stat_lx_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + stat_lx_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + stat_lx_out->AllocationSize.QuadPart = (LONGLONG)info->space_used;
- stat_lx_out->FileAttributes =
- nfs_file_info_to_attributes(superblock, info);
- @@ -585,6 +587,10 @@ void nfs41_file_info_cpy(
- if (attrmask->arr[1] & FATTR4_WORD1_SPACE_TOTAL) {
- dest->space_total = src->space_total;
- }
- + if (attrmask->arr[1] & FATTR4_WORD1_SPACE_USED) {
- + /* Per file-object size */
- + dest->space_used = src->space_used;
- + }
- if (attrmask->arr[1] & FATTR4_WORD1_SYSTEM) {
- dest->system = src->system;
- }
- diff --git a/daemon/lookup.c b/daemon/lookup.c
- index 21e5598..2829eaa 100644
- --- a/daemon/lookup.c
- +++ b/daemon/lookup.c
- @@ -1,5 +1,6 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -100,7 +101,8 @@ static void init_component_args(
- | FATTR4_WORD0_FSID | FATTR4_WORD0_FILEID
- | FATTR4_WORD0_HIDDEN | FATTR4_WORD0_ARCHIVE;
- args->attr_request.arr[1] = FATTR4_WORD1_MODE
- - | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_SYSTEM
- + | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_SPACE_USED
- + | FATTR4_WORD1_SYSTEM
- | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_CREATE
- | FATTR4_WORD1_TIME_MODIFY
- | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP;
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index b15629c..209b019 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -1,5 +1,6 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -79,16 +80,17 @@ static __inline bool_t is_delegation(
- #define NC_ATTR_CHANGE (1 << 1)
- #define NC_ATTR_FSID (1 << 2)
- #define NC_ATTR_SIZE (1 << 3)
- -#define NC_ATTR_HIDDEN (1 << 4)
- -#define NC_ATTR_ARCHIVE (1 << 5)
- -#define NC_ATTR_MODE (1 << 6)
- -#define NC_ATTR_NUMLINKS (1 << 7)
- -#define NC_ATTR_OWNER (1 << 8)
- -#define NC_ATTR_OWNER_GROUP (1 << 9)
- -#define NC_ATTR_TIME_ACCESS (1 << 10)
- -#define NC_ATTR_TIME_CREATE (1 << 11)
- -#define NC_ATTR_TIME_MODIFY (1 << 12)
- -#define NC_ATTR_SYSTEM (1 << 13)
- +#define NC_ATTR_SPACE_USED (1 << 4)
- +#define NC_ATTR_HIDDEN (1 << 5)
- +#define NC_ATTR_ARCHIVE (1 << 6)
- +#define NC_ATTR_MODE (1 << 7)
- +#define NC_ATTR_NUMLINKS (1 << 8)
- +#define NC_ATTR_OWNER (1 << 9)
- +#define NC_ATTR_OWNER_GROUP (1 << 10)
- +#define NC_ATTR_TIME_ACCESS (1 << 11)
- +#define NC_ATTR_TIME_CREATE (1 << 12)
- +#define NC_ATTR_TIME_MODIFY (1 << 13)
- +#define NC_ATTR_SYSTEM (1 << 14)
- /* attribute cache */
- struct attr_cache_entry {
- @@ -97,6 +99,7 @@ struct attr_cache_entry {
- uint32_t nc_attrs;
- uint64_t change;
- uint64_t size;
- + uint64_t space_used;
- uint64_t fileid;
- uint64_t fsid_major;
- uint64_t fsid_minor;
- @@ -369,6 +372,10 @@ static void attr_cache_update(
- entry->time_modify_s = info->time_modify.seconds;
- entry->time_modify_ns = info->time_modify.nseconds;
- }
- + if (info->attrmask.arr[1] & FATTR4_WORD1_SPACE_USED) {
- + entry->nc_attrs |= NC_ATTR_SPACE_USED;
- + entry->space_used = info->space_used;
- + }
- if (info->attrmask.arr[1] & FATTR4_WORD1_SYSTEM) {
- entry->nc_attrs |= NC_ATTR_SYSTEM;
- entry->system = info->system;
- @@ -455,6 +462,10 @@ static void copy_attrs(
- dst->attrmask.arr[0] |= FATTR4_WORD0_ARCHIVE;
- dst->archive = src->archive;
- }
- + if (src->nc_attrs & NC_ATTR_SPACE_USED) {
- + dst->attrmask.arr[1] |= FATTR4_WORD1_SPACE_USED;
- + dst->space_used = src->space_used;
- + }
- if (src->nc_attrs & NC_ATTR_SYSTEM) {
- dst->attrmask.arr[1] |= FATTR4_WORD1_SYSTEM;
- dst->system = src->system;
- diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
- index 38d3125..7f8f870 100644
- --- a/daemon/nfs41_ops.c
- +++ b/daemon/nfs41_ops.c
- @@ -1512,8 +1512,10 @@ int nfs41_setattr(
- nfs41_attr_cache_update(session_name_cache(session),
- file->fh.fileid, info);
- - if ((setattr_res.attrsset.count > 0) &&
- - (setattr_res.attrsset.arr[0] & FATTR4_WORD0_SIZE))
- + if (((setattr_res.attrsset.count > 0) &&
- + (setattr_res.attrsset.arr[0] & FATTR4_WORD0_SIZE)) ||
- + (setattr_res.attrsset.count > 1) &&
- + (setattr_res.attrsset.arr[1] & FATTR4_WORD1_SPACE_USED))
- nfs41_superblock_space_changed(file->fh.superblock);
- out:
- return status;
- diff --git a/daemon/nfs41_superblock.c b/daemon/nfs41_superblock.c
- index 185ad5c..baf33fc 100644
- --- a/daemon/nfs41_superblock.c
- +++ b/daemon/nfs41_superblock.c
- @@ -142,7 +142,8 @@ static int get_superblock_attrs(
- | FATTR4_WORD0_FSID | FATTR4_WORD0_FILEID
- | FATTR4_WORD0_HIDDEN | FATTR4_WORD0_ARCHIVE;
- superblock->default_getattr.arr[1] = FATTR4_WORD1_MODE
- - | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_SYSTEM
- + | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_SPACE_USED
- + | FATTR4_WORD1_SYSTEM
- | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_CREATE
- | FATTR4_WORD1_TIME_MODIFY;
- superblock->default_getattr.arr[2] = 0;
- diff --git a/daemon/nfs41_types.h b/daemon/nfs41_types.h
- index 1596d3d..59f1fd8 100644
- --- a/daemon/nfs41_types.h
- +++ b/daemon/nfs41_types.h
- @@ -1,5 +1,6 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -208,6 +209,7 @@ typedef struct __nfs41_file_info {
- nfsacl41 *acl;
- uint64_t change;
- uint64_t size;
- + uint64_t space_used;
- uint32_t type;
- uint32_t numlinks;
- uint32_t rdattr_error;
- diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
- index 84c5f7f..21314fd 100644
- --- a/daemon/nfs41_xdr.c
- +++ b/daemon/nfs41_xdr.c
- @@ -1873,6 +1873,10 @@ static bool_t decode_file_attrs(
- if (!xdr_u_hyper(xdr, &info->space_total))
- return FALSE;
- }
- + if (attrs->attrmask.arr[1] & FATTR4_WORD1_SPACE_USED) {
- + if (!xdr_u_hyper(xdr, &info->space_used))
- + return FALSE;
- + }
- if (attrs->attrmask.arr[1] & FATTR4_WORD1_SYSTEM) {
- if (!xdr_bool(xdr, &info->system))
- return FALSE;
- diff --git a/daemon/readdir.c b/daemon/readdir.c
- index 5fa883b..2723b74 100644
- --- a/daemon/readdir.c
- +++ b/daemon/readdir.c
- @@ -1,5 +1,6 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -372,9 +373,9 @@ static void readdir_copy_dir_info(
- info->fdi.ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- }
- - info->fdi.EndOfFile.QuadPart =
- - info->fdi.AllocationSize.QuadPart =
- - entry->attr_info.size;
- + info->fdi.EndOfFile.QuadPart = entry->attr_info.size;
- + info->fdi.AllocationSize.QuadPart = entry->attr_info.space_used;
- +
- info->fdi.FileAttributes =
- nfs_file_info_to_attributes(superblock, &entry->attr_info);
- }
- diff --git a/daemon/setattr.c b/daemon/setattr.c
- index 1d02042..da5dac6 100644
- --- a/daemon/setattr.c
- +++ b/daemon/setattr.c
- @@ -1,5 +1,6 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -502,6 +503,15 @@ static int handle_nfs41_set_size(void *daemon_context, setattr_upcall_args *args
- FILE_INFORMATION_CLASS2string(args->set_class),
- (long long)size->QuadPart));
- + /*
- + * We cannot set the allocation size, the NFS server handles this
- + * automagically
- + */
- + if (args->set_class == FileAllocationInformation) {
- + status = NO_ERROR;
- + goto out;
- + }
- +
- /* break read delegations before SETATTR */
- nfs41_delegation_return(state->session, &state->file,
- OPEN_DELEGATE_READ, FALSE);
- diff --git a/sys/nfs41sys_ea.c b/sys/nfs41sys_ea.c
- index 0803f1b..b5f12c3 100644
- --- a/sys/nfs41sys_ea.c
- +++ b/sys/nfs41sys_ea.c
- @@ -174,12 +174,13 @@ void unmarshal_nfs41_eaget(
- static void print_nfs3_attrs(
- nfs3_attrs *attrs)
- {
- - DbgP("type=%d mode=0%o nlink=%d size=%lld "
- + DbgP("type=%d mode=0%o nlink=%d "
- + "size=%lld used=%lld"
- "atime=(tv_sec=%ld,tv_nsec=%lu) "
- "mtime=(tv_sec=%ld,tv_nsec=%lu) "
- "ctime=(tv_sec=%ld,tv_nsec=%lu)\n",
- attrs->type, attrs->mode, attrs->nlink,
- - (long long)attrs->size,
- + (long long)attrs->size, (long long)attrs->used,
- (long)attrs->atime.tv_sec, (unsigned long)attrs->atime.tv_nsec,
- (long)attrs->mtime.tv_sec, (unsigned long)attrs->mtime.tv_nsec,
- (long)attrs->ctime.tv_sec, (unsigned long)attrs->ctime.tv_nsec);
- @@ -228,8 +229,9 @@ static void create_nfs3_attrs(
- attrs->gid = nfs41_fcb->owner_group_local_gid;
- #endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
- attrs->nlink = nfs41_fcb->StandardInfo.NumberOfLinks;
- - attrs->size = attrs->used =
- - nfs41_fcb->StandardInfo.EndOfFile.QuadPart;
- + attrs->size = nfs41_fcb->StandardInfo.EndOfFile.QuadPart;
- + attrs->used = nfs41_fcb->StandardInfo.AllocationSize.QuadPart;
- +
- /*
- * NFSv4.1 |nfs41_fsid| contains two 64bit fields (|major|,
- * |minor|), but the |nfs3_attrs.fsid| field is only one 64bit
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index f6457e5..5f59d7d 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -593,9 +593,6 @@ NTSTATUS nfs41_SetFileInformation(
- (PFILE_ALLOCATION_INFORMATION)RxContext->Info.Buffer;
- nfs41_fcb->StandardInfo.AllocationSize.QuadPart = info->AllocationSize.QuadPart;
- - if (nfs41_fcb->StandardInfo.EndOfFile.QuadPart > info->AllocationSize.QuadPart) {
- - nfs41_fcb->StandardInfo.EndOfFile.QuadPart = info->AllocationSize.QuadPart;
- - }
- break;
- }
- case FileEndOfFileInformation:
- @@ -603,13 +600,7 @@ NTSTATUS nfs41_SetFileInformation(
- PFILE_END_OF_FILE_INFORMATION info =
- (PFILE_END_OF_FILE_INFORMATION)RxContext->Info.Buffer;
- - if (info->EndOfFile.QuadPart > nfs41_fcb->StandardInfo.AllocationSize.QuadPart) {
- - nfs41_fcb->StandardInfo.AllocationSize.QuadPart =
- - nfs41_fcb->StandardInfo.EndOfFile.QuadPart = info->EndOfFile.QuadPart;
- - }
- - else {
- - nfs41_fcb->StandardInfo.EndOfFile.QuadPart = info->EndOfFile.QuadPart;
- - }
- + nfs41_fcb->StandardInfo.EndOfFile.QuadPart = info->EndOfFile.QuadPart;
- break;
- }
- case FileRenameInformation:
- --
- 2.45.1
- From c9a093013609bd241ffff90b6dac609fe184ac2a Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 17 Feb 2025 13:53:19 +0100
- Subject: [PATCH 2/8] cygwin: Add "sparse file support" section to
- README.bintarball.txt
- Add "sparse file support" section to README.bintarball.txt
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/README.bintarball.txt | 18 ++++++++++++++++++
- 1 file changed, 18 insertions(+)
- diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
- index 4c3ca12..c40c24f 100644
- --- a/cygwin/README.bintarball.txt
- +++ b/cygwin/README.bintarball.txt
- @@ -67,6 +67,24 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11&Windows Server 2019
- - Cygwin /usr/bin/setfacl+/usr/bin/getfacl
- - Windows Explorer ACL dialog
- +- Sparse file support
- + - Full sparse file support, including creation, punching holes
- + (via NFSv4.2 DEALLOCATE), enumeration of hole&data ranges etc.
- + - Supports Win32 APIs |FSCTL_QUERY_ALLOCATED_RANGES|,
- + |FSCTL_SET_SPARSE|, |FSCTL_SET_ZERO_DATA|; NFSv4.1
- + |FATTR4_WORD1_SPACE_USED| is mapped to Win32
- + |FILE_STANDARD_INFORMATION.AllocationSize| and
- + |NfsV3Attributes.used| EA for sparse file support.
- + - Cygwin >= 3.6 support POSIX-1.2024 |lseek(...,SEEK_HOLE,...)|
- + and |lseek(...,SEEK_DATA,...)|, coreutils /usr/bin/fallocate
- + and $ /usr/bin/cp --sparse=auto src dest #
- + - /cygdrive/c/Windows/system32/fsutil sparse queryrange myfile.dat
- + can be used to enumerate ranges where data are allocated
- + (BUG: Win10+Win11 fsutil only support 64 data ranges, the
- + filesystem itself supports an unlimited number of data ranges)
- + - /cygdrive/c/Windows/system32/xcopy /sparse (on Win11) can be
- + used to copy sparse files
- +
- - Symlink reparse and translation support
- - Translates Win32/NT symlink syntax (e.g.
- $ mklink /D ... Y:\tmp\ #) to NFS/POSIX syntax (e.g.
- --
- 2.45.1
- From 2c1767ab799808fbcde9e9d4321426bac71911d5 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 17 Feb 2025 14:00:53 +0100
- Subject: [PATCH 3/8] cygwin: msnfs41client.bash needs license template
- msnfs41client.bash needs license template
- Reported-by: Cedric Blancher <cedric.blancher@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/devel/msnfs41client.bash | 24 ++++++++++++++++++++++++
- 1 file changed, 24 insertions(+)
- diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
- index a46e7f7..505f8c3 100755
- --- a/cygwin/devel/msnfs41client.bash
- +++ b/cygwin/devel/msnfs41client.bash
- @@ -1,5 +1,29 @@
- #!/bin/bash
- +#
- +# MIT License
- +#
- +# Copyright (c) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- +#
- +# Permission is hereby granted, free of charge, to any person obtaining a copy
- +# of this software and associated documentation files (the "Software"), to deal
- +# in the Software without restriction, including without limitation the rights
- +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- +# copies of the Software, and to permit persons to whom the Software is
- +# furnished to do so, subject to the following conditions:
- +#
- +# The above copyright notice and this permission notice shall be included in all
- +# copies or substantial portions of the Software.
- +#
- +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- +# SOFTWARE.
- +#
- +
- #
- # msnfs41client.bash - simple Cygwin frontent for the msnfs41client
- # NFSv4.2/NFSv4.1 filesystem driver development
- --
- 2.45.1
- From 198aafb73f0a93f428aff59df6eb7cdeac9a5832 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 17 Feb 2025 14:11:17 +0100
- Subject: [PATCH 4/8] cygwin: msnfs41client install: Disable openfiles tracking
- by default
- msnfs41client.bash install: Disable openfiles tracking by default
- Reported-by: Cedric Blancher <cedric.blancher@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/devel/msnfs41client.bash | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
- diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
- index 505f8c3..701ad59 100755
- --- a/cygwin/devel/msnfs41client.bash
- +++ b/cygwin/devel/msnfs41client.bash
- @@ -193,7 +193,8 @@ function nfsclient_install
- sc query nfs41_driver
- domainname
- - openfiles /local ON
- + #openfiles /local ON
- + openfiles /local OFF
- #
- # install "msnfs41client run_daemon" as system service
- --
- 2.45.1
- From 0d4eb2867423a43f5dad40f1b524627161ef5c07 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 17 Feb 2025 14:50:59 +0100
- Subject: [PATCH 5/8] cygwin: mount_sshnfs+sshnfs should use 15min timeout via
- ServerAliveInterval+ServerAliveCountMax
- mount_sshnfs+sshnfs should use 15min timeout via
- ServerAliveInterval=10 and ServerAliveCountMax=90 to avoid issues
- with instable WIFI connections.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/utils/mount_sshnfs/mount_sshnfs.ksh | 12 ++++++++----
- cygwin/utils/sshnfs/sshnfs.ksh | 10 +++++++++-
- 2 files changed, 17 insertions(+), 5 deletions(-)
- diff --git a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- index ace325a..316b999 100644
- --- a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- +++ b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- @@ -3,7 +3,7 @@
- #
- # MIT License
- #
- -# Copyright (c) 2023-2024 Roland Mainz <roland.mainz@nrubsig.org>
- +# Copyright (c) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- #
- # Permission is hereby granted, free of charge, to any person obtaining a copy
- # of this software and associated documentation files (the "Software"), to deal
- @@ -422,7 +422,7 @@ function cmd_mount
- # fixme: Need better text layout for $ mount_sshnfs mount --man #
- typeset -r mount_sshnfs_cmdmount_usage=$'+
- - [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2024-11-25 \$\n]
- + [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2025-02-17 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mount_sshnfs mount - mount NFSv4 filesystem through ssh
- tunnel]
- @@ -635,6 +635,8 @@ function cmd_mount
- # for a benchmark) and lower latency, as NFS is
- # a bit latency-sensitive
- # - We turn compression off, as it incrases latency
- + # - ServerAliveInterval+ServerAliveCountMax ==
- + # 15min timeout (10sec*6*15)
- #
- ssh \
- -L "${c.local_forward_port}:localhost:2049" \
- @@ -643,6 +645,8 @@ function cmd_mount
- -f -o 'ExitOnForwardFailure=yes' \
- -o 'Compression=no' \
- -o 'Ciphers=aes128-cbc,aes128-ctr' \
- + '-o' 'ServerAliveInterval=10' \
- + '-o' "ServerAliveCountMax=$((6*15))" \
- "${c.ssh_jumphost_args[@]}" \
- "${c.nfsserver_ssh_login_name}@${c.nfs_server.host}"
- if (( $? != 0 )) ; then
- @@ -788,7 +792,7 @@ function cmd_umount
- typeset mydebug=false # fixme: should be "bool" for ksh93v
- # fixme: Need better text layout for $ mount_sshnfs mount --man #
- typeset -r mount_sshnfs_cmdumount_usage=$'+
- - [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2024-11-25 \$\n]
- + [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2025-02-17 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mount_sshnfs umount - unmount NFSv4 filesystem mounted
- via mount_sshnfs mount]
- @@ -892,7 +896,7 @@ function main
- # fixme: Need better text layout for $ mount_sshnfs --man #
- typeset -r mount_sshnfs_usage=$'+
- - [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2024-11-25 \$\n]
- + [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2025-02-17 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mount_sshnfs - mount/umount NFSv4 filesystem via ssh
- tunnel]
- diff --git a/cygwin/utils/sshnfs/sshnfs.ksh b/cygwin/utils/sshnfs/sshnfs.ksh
- index 6582ae2..b6c1a3d 100644
- --- a/cygwin/utils/sshnfs/sshnfs.ksh
- +++ b/cygwin/utils/sshnfs/sshnfs.ksh
- @@ -3,7 +3,7 @@
- #
- # MIT License
- #
- -# Copyright (c) 2023-2024 Roland Mainz <roland.mainz@nrubsig.org>
- +# Copyright (c) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- #
- # Permission is hereby granted, free of charge, to any person obtaining a copy
- # of this software and associated documentation files (the "Software"), to deal
- @@ -486,6 +486,8 @@ function main
- # for a benchmark) and lower latency, as NFS is
- # a bit latency-sensitive
- # - We turn compression off, as it incrases latency
- + # - ServerAliveInterval+ServerAliveCountMax ==
- + # 15min timeout (10sec*6*15)
- #
- ssh \
- -L "${c.local_forward_port}:localhost:2049" \
- @@ -494,6 +496,8 @@ function main
- -f -o 'ExitOnForwardFailure=yes' \
- -o 'Compression=no' \
- -o 'Ciphers=aes128-cbc,aes128-ctr' \
- + -o 'ServerAliveInterval=10' \
- + -o "ServerAliveCountMax=$((6*15))" \
- "${c.ssh_jumphost_args[@]}" \
- "${c.nfsserver_ssh_login_name}@${c.nfs_server.host}"
- if (( $? != 0 )) ; then
- @@ -534,12 +538,16 @@ function main
- # for a benchmark) and lower latency, as NFS is
- # a bit latency-sensitive
- # - We turn compression off, as it incrases latency
- + # - ServerAliveInterval+ServerAliveCountMax ==
- + # 15min timeout (10sec*6*15)
- #
- c.args=(
- '-R' "${c.destination_nfs_port}:localhost:${c.local_forward_port}"
- '-o' 'ExitOnForwardFailure=yes'
- '-o' 'Compression=no'
- '-o' 'Ciphers=aes128-cbc,aes128-ctr'
- + '-o' 'ServerAliveInterval=10' \
- + '-o' "ServerAliveCountMax=$((6*15))" \
- "${c.args[@]}"
- )
- ;;
- --
- 2.45.1
- From c2876d941a02fc352d38a4a70655c093d666a4c0 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 17 Feb 2025 16:07:42 +0100
- Subject: [PATCH 6/8] cygwin: Need workaround for mount_sshnfs failure with
- newer Cygwin/ksh93 combination
- Need workaround for mount_sshnfs failure with newer Cygwin/ksh93
- combination, e.g. that sometimes stdout="${ cmd ; }" only reads the
- first character (which breaks extraction of the DOS device letter
- from nfs_mount output).
- Observed with ksh93u+m/1.0.10 2024-08-01+Cygwin 3.6.0-0.374.g4dd859d01c22.x86_64
- Reported-by: Takeshi Nishimura <takeshi.nishimura.linux@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/utils/mount_sshnfs/mount_sshnfs.ksh | 17 ++++++++++++++++-
- 1 file changed, 16 insertions(+), 1 deletion(-)
- diff --git a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- index 316b999..25af7e3 100644
- --- a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- +++ b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- @@ -692,7 +692,22 @@ function cmd_mount
- # fixme: we should set LC_ALL=C because below we depend on
- # a l10n message
- - stdout="${ "${c.msnfsv41_nfsmountcmd}" "${mount_args[@]}" ; (( retval=$? )) ;}"
- + if false ; then
- + stdout="${ "${c.msnfsv41_nfsmountcmd}" "${mount_args[@]}" ; (( retval=$? )) ;}"
- + else
- + #
- + # FIXME: workaround for Cygwin 3.6 issue that
- + # stdout="${ cmd ; }" only reads the first character
- + # Observed with ksh93u+m/1.0.10 2024-08-01+Cygwin
- + # 3.6.0-0.374.g4dd859d01c22.x86_64
- + #
- + typeset tmpfilename="$(mktemp '/tmp/mount_sshnfs_XXXXXXXXXX.tmp')"
- +
- + "${c.msnfsv41_nfsmountcmd}" "${mount_args[@]}" >"${tmpfilename}" ; (( retval=$? ))
- + IFS='' read stdout <"${tmpfilename}"
- + rm -f -- "${tmpfilename}"
- + fi
- +
- cat <<<"$stdout"
- if (( retval == 0 )) ; then
- --
- 2.45.1
- From a302c2f2c571e1ca5d10f4ce36aab13a26454814 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 17 Feb 2025 16:22:33 +0100
- Subject: [PATCH 7/8] cygwin: mount_sshnfs+sshnfs should use /tmp as prefix for
- temporary mount point for r/o root fs
- mount_sshnfs+sshnfs should use /tmp as prefix for temporary mount point
- to handle the case that the systems's root filesystem is read-only.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/utils/mount_sshnfs/mount_sshnfs.ksh | 24 +++++++++++-----------
- cygwin/utils/sshnfs/sshnfs.ksh | 8 ++++----
- 2 files changed, 16 insertions(+), 16 deletions(-)
- diff --git a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- index 25af7e3..2426b5f 100644
- --- a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- +++ b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- @@ -32,15 +32,15 @@
- # Example usage:
- #
- # 1. UNIX/Linux: Mount&&unmount /export/home/rmainz on NFS server "/export/home/rmainz":
- -# $ mkdir -p /foobarmnt
- -# $ ksh mount_sshnfs.ksh mount ssh+nfs://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
- -# $ mount_sshnfs.ksh umount /foobarmnt
- +# $ mkdir -p /tmp/foobarmnt
- +# $ ksh mount_sshnfs.ksh mount ssh+nfs://rmainz@derfwpc5131//export/home/rmainz /tmp/foobarmnt
- +# $ mount_sshnfs.ksh umount /tmp/foobarmnt
- #
- #
- # 2. UNIX/Linux: Mount&&unmount /export/home/rmainz on NFS server "/export/home/rmainz" via SSH jumphost rmainz@10.49.20.131:
- -# $ mkdir -p /foobarmnt
- -# $ ksh mount_sshnfs.ksh mount -o ro,mount_sshnfs_jumphost=rmainz@10.49.20.131 ssh+nfs://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
- -# $ mount_sshnfs.ksh umount /foobarmnt
- +# $ mkdir -p /tmp/foobarmnt
- +# $ ksh mount_sshnfs.ksh mount -o ro,mount_sshnfs_jumphost=rmainz@10.49.20.131 ssh+nfs://rmainz@derfwpc5131//export/home/rmainz /tmp/foobarmnt
- +# $ mount_sshnfs.ksh umount /tmp/foobarmnt
- #
- #
- @@ -927,15 +927,15 @@ function main
- [+EXAMPLES]{
- [+?Example 1:][+?Mount&&unmount /export/home/rmainz on NFS server "/export/home/rmainz"]{
- -[+\n# mkdir -p /foobarmnt
- -# mount_sshnfs mount ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
- -# mount_sshnfs umount /foobarmnt
- +[+\n# mkdir -p /tmp/foobarmnt
- +# mount_sshnfs mount ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /tmp/foobarmnt
- +# mount_sshnfs umount /tmp/foobarmnt
- ]
- }
- [+?Example 2:][+?Mount&&unmount /export/home/rmainz on NFS server "/export/home/rmainz" via SSH jumphost rmainz@10.49.20.131]{
- -[+\n# mkdir -p /foobarmnt
- -# mount_sshnfs mount -o ro,mount_sshnfs_jumphost=rmainz@10.49.20.131 ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
- -# mount_sshnfs umount /foobarmnt
- +[+\n# mkdir -p /tmp/foobarmnt
- +# mount_sshnfs mount -o ro,mount_sshnfs_jumphost=rmainz@10.49.20.131 ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /tmp/foobarmnt
- +# mount_sshnfs umount /tmp/foobarmnt
- ]
- }
- }
- diff --git a/cygwin/utils/sshnfs/sshnfs.ksh b/cygwin/utils/sshnfs/sshnfs.ksh
- index b6c1a3d..80bc52e 100644
- --- a/cygwin/utils/sshnfs/sshnfs.ksh
- +++ b/cygwin/utils/sshnfs/sshnfs.ksh
- @@ -513,8 +513,8 @@ function main
- "${c.nfsserver_ssh_login_name}@${c.nfs_server.host}"
- print -u2 -f $"# Linux: Use this to mount the directory:\n"
- - print -u2 -f $"# $ mkdir /mnt_nfs\n"
- - print -u2 -f $"# $ mount -vvv -t nfs -o vers=4.2,port=%d localhost:%s /mnt_nfs\n" \
- + print -u2 -f $"# $ mkdir /tmp/mnt_nfs\n"
- + print -u2 -f $"# $ mount -vvv -t nfs -o vers=4.2,port=%d localhost:%s /tmp/mnt_nfs\n" \
- c.destination_nfs_port \
- "${c.nfs_server.uripath}"
- print -u2 -f $"\n"
- @@ -585,8 +585,8 @@ function main
- (( c.destination_nfs_port += (mypid+myuid+PPID) % 16381 ))
- print -u2 -f $"# Use this to mount the directory:\n"
- - print -u2 -f $"# $ mkdir /mnt_nfs\n"
- - print -u2 -f $"# $ mount -vvv -t nfs -o vers=4.2,port=%d localhost:%s /mnt_nfs\n" \
- + print -u2 -f $"# $ mkdir /tmp/mnt_nfs\n"
- + print -u2 -f $"# $ mount -vvv -t nfs -o vers=4.2,port=%d localhost:%s /tmp/mnt_nfs\n" \
- c.destination_nfs_port \
- "${c.nfs_server.uripath}"
- --
- 2.45.1
- From c9a0b68a85747609e84142962a1c839a4e4f657a Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 17 Feb 2025 16:33:07 +0100
- Subject: [PATCH 8/8] cygwin: Add requirements for full sparse file support
- Add requirements (Cygwin >= 3.6+NFSv4.2 server) for full sparse
- file support.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/README.bintarball.txt | 1 +
- 1 file changed, 1 insertion(+)
- diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
- index c40c24f..1958023 100644
- --- a/cygwin/README.bintarball.txt
- +++ b/cygwin/README.bintarball.txt
- @@ -68,6 +68,7 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11&Windows Server 2019
- - Windows Explorer ACL dialog
- - Sparse file support
- + - Requires Cygwin 3.6 and a MFSv4.2 server
- - Full sparse file support, including creation, punching holes
- (via NFSv4.2 DEALLOCATE), enumeration of hole&data ranges etc.
- - Supports Win32 APIs |FSCTL_QUERY_ALLOCATED_RANGES|,
- --
- 2.45.1
msnfs41client: Patches for |FATTR4_WORD1_SPACE_USED|, utils, docs+misc, 2025-02-17
Posted by Anonymous on Mon 17th Feb 2025 17:55
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.