- From ea84a6190bc08d42b674b0c90397eec28f1843b2 Mon Sep 17 00:00:00 2001
- From: Dan Shelton <dan.f.shelton@gmail.com>
- Date: Sat, 26 Apr 2025 20:30:48 +0200
- Subject: [PATCH 1/4] daemon: Fix arithmetic overflow issues
- Fix arithmetic overflow issues.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/nfs42_xdr.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
- diff --git a/daemon/nfs42_xdr.c b/daemon/nfs42_xdr.c
- index ab7248e..1e9c731 100644
- --- a/daemon/nfs42_xdr.c
- +++ b/daemon/nfs42_xdr.c
- @@ -203,9 +203,9 @@ static bool_t decode_read_plus_res_ok(
- ("i=%d, decoding 'bytes' failed\n", (int)i));
- return FALSE;
- }
- - read_data_len = __max(read_data_len,
- + read_data_len = __max((size_t)read_data_len,
- ((size_t)(contents[i].u.data.data - res->data) +
- - contents[i].u.data.data_len));
- + (size_t)contents[i].u.data.data_len));
- }
- break;
- case NFS4_CONTENT_HOLE:
- @@ -232,7 +232,7 @@ static bool_t decode_read_plus_res_ok(
- */
- if (((hole_buff - res->data) + hole_length) >
- res->data_len) {
- - hole_length = res->data_len -
- + hole_length = (uint64_t)res->data_len -
- (hole_buff - res->data);
- }
- --
- 2.45.1
- From 073c79ec054d8345aa5e662ccf061501aabec736 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sat, 26 Apr 2025 20:32:03 +0200
- Subject: [PATCH 2/4] daemon: |FATTR4_*| values cannot be an |enum|
- |FATTR4_*| values cannot be an |enum|, because in ISO C17 an |enum|
- only has the type |signed int|, while any |MAKE_WORDx()| macro
- with a value of |31| will cause |signed|/|unsigned| issues.
- Fix is to turn all |FATTR4_*| values into #define statements.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/nfs41_const.h | 171 ++++++++++++++++++++------------------
- daemon/nfs41_superblock.c | 2 +-
- 2 files changed, 90 insertions(+), 83 deletions(-)
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index 2d6f9c5..fcad41e 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -250,96 +250,103 @@ enum nfsstat4 {
- NFS4ERR_XATTR2BIG = 10096
- };
- -#define MAKE_WORD0(XXX) (1 << (XXX))
- -#define MAKE_WORD1(XXX) (1 << ((XXX)-32))
- -#define MAKE_WORD2(XXX) (1 << ((XXX)-64))
- +/*
- + * NFSv4 attribute definitions
- + *
- + * Notes:
- + * - We cannot use |enum| because the default enum type is a
- + * |signed int|, which will not work for any |MAKE_WORDx()| macro
- + * with a value of 31
- + */
- +#define MAKE_WORD0(x) (1UL << (x))
- +#define MAKE_WORD1(x) (1UL << ((x)-32))
- +#define MAKE_WORD2(x) (1UL << ((x)-64))
- -enum {
- /*
- * Mandatory Attributes
- */
- - FATTR4_WORD0_SUPPORTED_ATTRS = MAKE_WORD0(0),
- - FATTR4_WORD0_TYPE = MAKE_WORD0(1),
- - FATTR4_WORD0_FH_EXPIRE_TYPE = MAKE_WORD0(2),
- - FATTR4_WORD0_CHANGE = MAKE_WORD0(3),
- - FATTR4_WORD0_SIZE = MAKE_WORD0(4),
- - FATTR4_WORD0_LINK_SUPPORT = MAKE_WORD0(5),
- - FATTR4_WORD0_SYMLINK_SUPPORT = MAKE_WORD0(6),
- - FATTR4_WORD0_NAMED_ATTR = MAKE_WORD0(7),
- - FATTR4_WORD0_FSID = MAKE_WORD0(8),
- - FATTR4_WORD0_UNIQUE_HANDLES = MAKE_WORD0(9),
- - FATTR4_WORD0_LEASE_TIME = MAKE_WORD0(10),
- - FATTR4_WORD0_RDATTR_ERROR = MAKE_WORD0(11),
- - FATTR4_WORD0_FILEHANDLE = MAKE_WORD0(19),
- - FATTR4_WORD2_SUPPATTR_EXCLCREAT = MAKE_WORD2(75),
- +#define FATTR4_WORD0_SUPPORTED_ATTRS MAKE_WORD0(0)
- +#define FATTR4_WORD0_TYPE MAKE_WORD0(1)
- +#define FATTR4_WORD0_FH_EXPIRE_TYPE MAKE_WORD0(2)
- +#define FATTR4_WORD0_CHANGE MAKE_WORD0(3)
- +#define FATTR4_WORD0_SIZE MAKE_WORD0(4)
- +#define FATTR4_WORD0_LINK_SUPPORT MAKE_WORD0(5)
- +#define FATTR4_WORD0_SYMLINK_SUPPORT MAKE_WORD0(6)
- +#define FATTR4_WORD0_NAMED_ATTR MAKE_WORD0(7)
- +#define FATTR4_WORD0_FSID MAKE_WORD0(8)
- +#define FATTR4_WORD0_UNIQUE_HANDLES MAKE_WORD0(9)
- +#define FATTR4_WORD0_LEASE_TIME MAKE_WORD0(10)
- +#define FATTR4_WORD0_RDATTR_ERROR MAKE_WORD0(11)
- +#define FATTR4_WORD0_FILEHANDLE MAKE_WORD0(19)
- +#define FATTR4_WORD2_SUPPATTR_EXCLCREAT MAKE_WORD2(75)
- /*
- * Recommended Attributes
- */
- - FATTR4_WORD0_ACL = MAKE_WORD0(12),
- - FATTR4_WORD0_ACLSUPPORT = MAKE_WORD0(13),
- - FATTR4_WORD0_ARCHIVE = MAKE_WORD0(14),
- - FATTR4_WORD0_CANSETTIME = MAKE_WORD0(15),
- - FATTR4_WORD0_CASE_INSENSITIVE = MAKE_WORD0(16),
- - FATTR4_WORD0_CASE_PRESERVING = MAKE_WORD0(17),
- - FATTR4_WORD0_CHOWN_RESTRICTED = MAKE_WORD0(18),
- - FATTR4_WORD0_FILEID = MAKE_WORD0(20),
- - FATTR4_WORD0_FILES_AVAIL = MAKE_WORD0(21),
- - FATTR4_WORD0_FILES_FREE = MAKE_WORD0(22),
- - FATTR4_WORD0_FILES_TOTAL = MAKE_WORD0(23),
- - FATTR4_WORD0_FS_LOCATIONS = MAKE_WORD0(24),
- - FATTR4_WORD0_HIDDEN = MAKE_WORD0(25),
- - FATTR4_WORD0_HOMOGENEOUS = MAKE_WORD0(26),
- - FATTR4_WORD0_MAXFILESIZE = MAKE_WORD0(27),
- - FATTR4_WORD0_MAXLINK = MAKE_WORD0(28),
- - FATTR4_WORD0_MAXNAME = MAKE_WORD0(29),
- - FATTR4_WORD0_MAXREAD = MAKE_WORD0(30),
- - FATTR4_WORD0_MAXWRITE = MAKE_WORD0(31),
- - FATTR4_WORD1_MIMETYPE = MAKE_WORD1(32),
- - FATTR4_WORD1_MODE = MAKE_WORD1(33),
- - FATTR4_WORD1_NO_TRUNC = MAKE_WORD1(34),
- - FATTR4_WORD1_NUMLINKS = MAKE_WORD1(35),
- - FATTR4_WORD1_OWNER = MAKE_WORD1(36),
- - FATTR4_WORD1_OWNER_GROUP = MAKE_WORD1(37),
- - FATTR4_WORD1_QUOTA_AVAIL_HARD = MAKE_WORD1(38),
- - FATTR4_WORD1_QUOTA_AVAIL_SOFT = MAKE_WORD1(39),
- - FATTR4_WORD1_QUOTA_USED = MAKE_WORD1(40),
- - FATTR4_WORD1_RAWDEV = MAKE_WORD1(41),
- - FATTR4_WORD1_SPACE_AVAIL = MAKE_WORD1(42),
- - FATTR4_WORD1_SPACE_FREE = MAKE_WORD1(43),
- - FATTR4_WORD1_SPACE_TOTAL = MAKE_WORD1(44),
- - FATTR4_WORD1_SPACE_USED = MAKE_WORD1(45),
- - FATTR4_WORD1_SYSTEM = MAKE_WORD1(46),
- - FATTR4_WORD1_TIME_ACCESS = MAKE_WORD1(47),
- - FATTR4_WORD1_TIME_ACCESS_SET = MAKE_WORD1(48),
- - FATTR4_WORD1_TIME_BACKUP = MAKE_WORD1(49),
- - FATTR4_WORD1_TIME_CREATE = MAKE_WORD1(50),
- - FATTR4_WORD1_TIME_DELTA = MAKE_WORD1(51),
- - FATTR4_WORD1_TIME_METADATA = MAKE_WORD1(52),
- - FATTR4_WORD1_TIME_MODIFY = MAKE_WORD1(53),
- - FATTR4_WORD1_TIME_MODIFY_SET = MAKE_WORD1(54),
- - FATTR4_WORD1_MOUNTED_ON_FILEID = MAKE_WORD1(55),
- - FATTR4_WORD1_DIR_NOTIF_DELAY = MAKE_WORD1(56),
- - FATTR4_WORD1_DIRENT_NOTIF_DELAY = MAKE_WORD1(57),
- - FATTR4_WORD1_DACL = MAKE_WORD1(58),
- - FATTR4_WORD1_SACL = MAKE_WORD1(59),
- - FATTR4_WORD1_CHANGE_POLICY = MAKE_WORD1(60),
- - FATTR4_WORD1_FS_STATUS = MAKE_WORD1(61),
- - FATTR4_WORD1_FS_LAYOUT_TYPE = MAKE_WORD1(62),
- - FATTR4_WORD1_LAYOUT_HINT = MAKE_WORD1(63),
- - FATTR4_WORD2_LAYOUT_TYPE = MAKE_WORD2(64),
- - FATTR4_WORD2_LAYOUT_BLKSIZE = MAKE_WORD2(65),
- - FATTR4_WORD2_LAYOUT_ALIGNMENT = MAKE_WORD2(66),
- - FATTR4_WORD2_FS_LOCATIONS_INFO = MAKE_WORD2(67),
- - FATTR4_WORD2_MDSTHRESHOLD = MAKE_WORD2(68),
- - FATTR4_WORD2_RETENTION_GET = MAKE_WORD2(69),
- - FATTR4_WORD2_RETENTION_SET = MAKE_WORD2(70),
- - FATTR4_WORD2_RETENTEVT_GET = MAKE_WORD2(71),
- - FATTR4_WORD2_RETENTEVT_SET = MAKE_WORD2(72),
- - FATTR4_WORD2_RETENTION_HOLD = MAKE_WORD2(73),
- - FATTR4_WORD2_MODE_SET_MASKED = MAKE_WORD2(74),
- - FATTR4_WORD2_FS_CHARSET_CAP = MAKE_WORD2(76),
- -};
- +#define FATTR4_WORD0_ACL MAKE_WORD0(12)
- +#define FATTR4_WORD0_ACLSUPPORT MAKE_WORD0(13)
- +#define FATTR4_WORD0_ARCHIVE MAKE_WORD0(14)
- +#define FATTR4_WORD0_CANSETTIME MAKE_WORD0(15)
- +#define FATTR4_WORD0_CASE_INSENSITIVE MAKE_WORD0(16)
- +#define FATTR4_WORD0_CASE_PRESERVING MAKE_WORD0(17)
- +#define FATTR4_WORD0_CHOWN_RESTRICTED MAKE_WORD0(18)
- +#define FATTR4_WORD0_FILEID MAKE_WORD0(20)
- +#define FATTR4_WORD0_FILES_AVAIL MAKE_WORD0(21)
- +#define FATTR4_WORD0_FILES_FREE MAKE_WORD0(22)
- +#define FATTR4_WORD0_FILES_TOTAL MAKE_WORD0(23)
- +#define FATTR4_WORD0_FS_LOCATIONS MAKE_WORD0(24)
- +#define FATTR4_WORD0_HIDDEN MAKE_WORD0(25)
- +#define FATTR4_WORD0_HOMOGENEOUS MAKE_WORD0(26)
- +#define FATTR4_WORD0_MAXFILESIZE MAKE_WORD0(27)
- +#define FATTR4_WORD0_MAXLINK MAKE_WORD0(28)
- +#define FATTR4_WORD0_MAXNAME MAKE_WORD0(29)
- +#define FATTR4_WORD0_MAXREAD MAKE_WORD0(30)
- +#define FATTR4_WORD0_MAXWRITE MAKE_WORD0(31)
- +#define FATTR4_WORD1_MIMETYPE MAKE_WORD1(32)
- +#define FATTR4_WORD1_MODE MAKE_WORD1(33)
- +#define FATTR4_WORD1_NO_TRUNC MAKE_WORD1(34)
- +#define FATTR4_WORD1_NUMLINKS MAKE_WORD1(35)
- +#define FATTR4_WORD1_OWNER MAKE_WORD1(36)
- +#define FATTR4_WORD1_OWNER_GROUP MAKE_WORD1(37)
- +#define FATTR4_WORD1_QUOTA_AVAIL_HARD MAKE_WORD1(38)
- +#define FATTR4_WORD1_QUOTA_AVAIL_SOFT MAKE_WORD1(39)
- +#define FATTR4_WORD1_QUOTA_USED MAKE_WORD1(40)
- +#define FATTR4_WORD1_RAWDEV MAKE_WORD1(41)
- +#define FATTR4_WORD1_SPACE_AVAIL MAKE_WORD1(42)
- +#define FATTR4_WORD1_SPACE_FREE MAKE_WORD1(43)
- +#define FATTR4_WORD1_SPACE_TOTAL MAKE_WORD1(44)
- +#define FATTR4_WORD1_SPACE_USED MAKE_WORD1(45)
- +#define FATTR4_WORD1_SYSTEM MAKE_WORD1(46)
- +#define FATTR4_WORD1_TIME_ACCESS MAKE_WORD1(47)
- +#define FATTR4_WORD1_TIME_ACCESS_SET MAKE_WORD1(48)
- +#define FATTR4_WORD1_TIME_BACKUP MAKE_WORD1(49)
- +#define FATTR4_WORD1_TIME_CREATE MAKE_WORD1(50)
- +#define FATTR4_WORD1_TIME_DELTA MAKE_WORD1(51)
- +#define FATTR4_WORD1_TIME_METADATA MAKE_WORD1(52)
- +#define FATTR4_WORD1_TIME_MODIFY MAKE_WORD1(53)
- +#define FATTR4_WORD1_TIME_MODIFY_SET MAKE_WORD1(54)
- +#define FATTR4_WORD1_MOUNTED_ON_FILEID MAKE_WORD1(55)
- +#define FATTR4_WORD1_DIR_NOTIF_DELAY MAKE_WORD1(56)
- +#define FATTR4_WORD1_DIRENT_NOTIF_DELAY MAKE_WORD1(57)
- +#define FATTR4_WORD1_DACL MAKE_WORD1(58)
- +#define FATTR4_WORD1_SACL MAKE_WORD1(59)
- +#define FATTR4_WORD1_CHANGE_POLICY MAKE_WORD1(60)
- +#define FATTR4_WORD1_FS_STATUS MAKE_WORD1(61)
- +#define FATTR4_WORD1_FS_LAYOUT_TYPE MAKE_WORD1(62)
- +#define FATTR4_WORD1_LAYOUT_HINT MAKE_WORD1(63)
- +#define FATTR4_WORD2_LAYOUT_TYPE MAKE_WORD2(64)
- +#define FATTR4_WORD2_LAYOUT_BLKSIZE MAKE_WORD2(65)
- +#define FATTR4_WORD2_LAYOUT_ALIGNMENT MAKE_WORD2(66)
- +#define FATTR4_WORD2_FS_LOCATIONS_INFO MAKE_WORD2(67)
- +#define FATTR4_WORD2_MDSTHRESHOLD MAKE_WORD2(68)
- +#define FATTR4_WORD2_RETENTION_GET MAKE_WORD2(69)
- +#define FATTR4_WORD2_RETENTION_SET MAKE_WORD2(70)
- +#define FATTR4_WORD2_RETENTEVT_GET MAKE_WORD2(71)
- +#define FATTR4_WORD2_RETENTEVT_SET MAKE_WORD2(72)
- +#define FATTR4_WORD2_RETENTION_HOLD MAKE_WORD2(73)
- +#define FATTR4_WORD2_MODE_SET_MASKED MAKE_WORD2(74)
- +#define FATTR4_WORD2_FS_CHARSET_CAP MAKE_WORD2(76)
- +
- /*
- * File types
- diff --git a/daemon/nfs41_superblock.c b/daemon/nfs41_superblock.c
- index 3787905..918cb6c 100644
- --- a/daemon/nfs41_superblock.c
- +++ b/daemon/nfs41_superblock.c
- @@ -87,7 +87,7 @@ static int get_superblock_attrs(
- FATTR4_WORD0_LINK_SUPPORT | FATTR4_WORD0_SYMLINK_SUPPORT |
- FATTR4_WORD0_ACLSUPPORT | FATTR4_WORD0_CANSETTIME |
- FATTR4_WORD0_CASE_INSENSITIVE | FATTR4_WORD0_CASE_PRESERVING |
- - FATTR4_WORD0_MAXREAD | (uint32_t)(FATTR4_WORD0_MAXWRITE);
- + FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE;
- attr_request.arr[1] = FATTR4_WORD1_FS_LAYOUT_TYPE |
- FATTR4_WORD1_TIME_DELTA;
- attr_request.arr[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT;
- --
- 2.45.1
- From 5dbaf6e8ce14903546afb07d7e697e1ae0ccc9bf Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sat, 26 Apr 2025 21:50:11 +0200
- Subject: [PATCH 3/4] daemon: Implement |FATTR4_WORD2_CLONE_BLKSIZE| support
- Implement |FATTR4_WORD2_CLONE_BLKSIZE| support
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/daemon_debug.c | 11 +++++++++++
- daemon/fileinfoutil.c | 3 +++
- daemon/fsctl.c | 26 +++++++++++++++++++++++++-
- daemon/name_cache.c | 18 +++++++++++++++++-
- daemon/nfs41_const.h | 1 +
- daemon/nfs41_types.h | 1 +
- daemon/nfs41_xdr.c | 4 ++++
- 7 files changed, 62 insertions(+), 2 deletions(-)
- diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
- index 10fd4b9..7d81b9c 100644
- --- a/daemon/daemon_debug.c
- +++ b/daemon/daemon_debug.c
- @@ -1119,6 +1119,17 @@ void print_nfs41_file_info(
- PRNFS41FI_FMT("system=%d, ", (int)info->system);
- p += snprintf(p, (sizeof(buf)-(p-buf)), "} ");
- }
- + if (info->attrmask.count >= 3) {
- + PRNFS41FI_FMT("{ attrmask.arr[2]=0x%x, ",
- + (int)info->attrmask.arr[2]);
- +
- + if (info->attrmask.arr[2] & FATTR4_WORD2_CLONE_BLKSIZE) {
- + PRNFS41FI_FMT("clone_blksize=%ld, ",
- + (long)info->clone_blksize);
- + }
- +
- + p += snprintf(p, (sizeof(buf)-(p-buf)), "} ");
- + }
- dprintf_out("%s={ %s }\n", label, buf);
- }
- diff --git a/daemon/fileinfoutil.c b/daemon/fileinfoutil.c
- index 85a36ae..644d235 100644
- --- a/daemon/fileinfoutil.c
- +++ b/daemon/fileinfoutil.c
- @@ -631,6 +631,9 @@ void nfs41_file_info_cpy(
- if (attrmask->arr[2] & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
- dest->suppattr_exclcreat = src->suppattr_exclcreat;
- }
- + if (attrmask->arr[2] & FATTR4_WORD2_CLONE_BLKSIZE) {
- + dest->clone_blksize = src->clone_blksize;
- + }
- }
- if (flags & NFS41FILEINFOCPY_COPY_SYMLINK_DIR) {
- diff --git a/daemon/fsctl.c b/daemon/fsctl.c
- index 7d83c32..c191f39 100644
- --- a/daemon/fsctl.c
- +++ b/daemon/fsctl.c
- @@ -527,7 +527,12 @@ int handle_duplicatedata(void *daemon_context,
- #ifdef CLONE_PUNCH_HOLE_IF_CLONESIZE_BIGGER_THAN_SRCFILESIZE
- int64_t src_file_size;
- - bitmap4 attr_request = { .count = 1, .arr[0] = FATTR4_WORD0_SIZE };
- + bitmap4 attr_request = {
- + .count = 3,
- + .arr[0] = FATTR4_WORD0_SIZE,
- + .arr[1] = 0UL,
- + .arr[2] = FATTR4_WORD2_CLONE_BLKSIZE
- + };
- status = nfs41_getattr(session, src_file, &attr_request, &info);
- if (status) {
- eprintf("handle_duplicatedata: "
- @@ -536,6 +541,21 @@ int handle_duplicatedata(void *daemon_context,
- status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
- goto out;
- }
- +
- + EASSERT(bitmap_isset(&info.attrmask, 0, FATTR4_WORD0_SIZE));
- + if (bitmap_isset(&info.attrmask, 2, FATTR4_WORD2_CLONE_BLKSIZE)) {
- + DPRINTF(DDLVL,
- + ("handle_duplicatedata: "
- + "srcfile size=%lld, clone_blksize=%lu\n",
- + (long long)info.size,
- + (unsigned long)info.clone_blksize));
- + }
- + else {
- + DPRINTF(DDLVL,
- + ("handle_duplicatedata: srcfile size=%lld\n",
- + (long long)info.size));
- + }
- +
- src_file_size = info.size;
- if ((args->srcfileoffset+args->bytecount) > src_file_size)
- @@ -543,6 +563,10 @@ int handle_duplicatedata(void *daemon_context,
- else
- bytecount = args->bytecount;
- #else
- + /*
- + * FIXME: We should validate against |FATTR4_WORD2_CLONE_BLKSIZE|
- + * (if supported by NFSv4.2 server) in this codepath
- + */
- bytecount = args->bytecount;
- #endif /* CLONE_PUNCH_HOLE_IF_CLONESIZE_BIGGER_THAN_SRCFILESIZE */
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index bee2b4f..ffb66d5 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -91,6 +91,7 @@ static __inline bool_t is_delegation(
- #define NC_ATTR_TIME_CREATE (1 << 12)
- #define NC_ATTR_TIME_MODIFY (1 << 13)
- #define NC_ATTR_SYSTEM (1 << 14)
- +#define NC_ATTR_CLONE_BLKSIZE (1 << 15)
- /* attribute cache */
- struct attr_cache_entry {
- @@ -114,6 +115,7 @@ struct attr_cache_entry {
- unsigned hidden : 1;
- unsigned system : 1;
- unsigned archive : 1;
- + uint32_t clone_blksize;
- util_reltimestamp expiration;
- unsigned ref_count : 26;
- unsigned type : 4;
- @@ -386,6 +388,12 @@ static void attr_cache_update(
- entry->system = info->system;
- }
- }
- + if (info->attrmask.count > 2) {
- + if (info->attrmask.arr[2] & FATTR4_WORD2_CLONE_BLKSIZE) {
- + entry->nc_attrs |= NC_ATTR_CLONE_BLKSIZE;
- + entry->clone_blksize = info->clone_blksize;
- + }
- + }
- if (is_delegation(delegation))
- entry->delegated = TRUE;
- @@ -397,6 +405,7 @@ static void copy_attrs(
- {
- dst->attrmask.arr[0] = 0;
- dst->attrmask.arr[1] = 0;
- + dst->attrmask.arr[2] = 0;
- dst->attrmask.arr[0] |= FATTR4_WORD0_FILEID;
- dst->fileid = src->fileid;
- @@ -475,8 +484,15 @@ static void copy_attrs(
- dst->attrmask.arr[1] |= FATTR4_WORD1_SYSTEM;
- dst->system = src->system;
- }
- + if (src->nc_attrs & NC_ATTR_CLONE_BLKSIZE) {
- + dst->attrmask.arr[2] |= FATTR4_WORD2_CLONE_BLKSIZE;
- + dst->clone_blksize = src->clone_blksize;
- + }
- - if (dst->attrmask.arr[1] != 0) {
- + if (dst->attrmask.arr[2] != 0) {
- + dst->attrmask.count = 3;
- + }
- + else if (dst->attrmask.arr[1] != 0) {
- dst->attrmask.count = 2;
- }
- else {
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index fcad41e..2bc5c62 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -346,6 +346,7 @@ enum nfsstat4 {
- #define FATTR4_WORD2_RETENTION_HOLD MAKE_WORD2(73)
- #define FATTR4_WORD2_MODE_SET_MASKED MAKE_WORD2(74)
- #define FATTR4_WORD2_FS_CHARSET_CAP MAKE_WORD2(76)
- +#define FATTR4_WORD2_CLONE_BLKSIZE MAKE_WORD2(77)
- /*
- diff --git a/daemon/nfs41_types.h b/daemon/nfs41_types.h
- index f3f6a12..8501674 100644
- --- a/daemon/nfs41_types.h
- +++ b/daemon/nfs41_types.h
- @@ -221,6 +221,7 @@ typedef struct __nfs41_file_info {
- bool_t hidden;
- bool_t system;
- bool_t archive;
- + uint32_t clone_blksize;
- bool_t case_insensitive;
- bool_t case_preserving;
- bool_t symlink_dir;
- diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
- index 2d651a4..c36b20a 100644
- --- a/daemon/nfs41_xdr.c
- +++ b/daemon/nfs41_xdr.c
- @@ -1917,6 +1917,10 @@ static bool_t decode_file_attrs(
- if (!xdr_bitmap4(xdr, info->suppattr_exclcreat))
- return FALSE;
- }
- + if (attrs->attrmask.arr[2] & FATTR4_WORD2_CLONE_BLKSIZE) {
- + if (!xdr_u_int32_t(xdr, &info->clone_blksize))
- + return FALSE;
- + }
- }
- return TRUE;
- }
- --
- 2.45.1
- From 8fa6e9e6bfde55297c6e5133a078699b2f073043 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sat, 26 Apr 2025 21:58:11 +0200
- Subject: [PATCH 4/4] tests: nfsbuildtest: Generated mkinstalldirs should be
- newline-terminated
- nfsbuildtest: Generated mkinstalldirs should be newline-terminated.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/nfsbuildtest/nfsbuildtest.ksh93 | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
- diff --git a/tests/nfsbuildtest/nfsbuildtest.ksh93 b/tests/nfsbuildtest/nfsbuildtest.ksh93
- index f642ff9..864eff4 100644
- --- a/tests/nfsbuildtest/nfsbuildtest.ksh93
- +++ b/tests/nfsbuildtest/nfsbuildtest.ksh93
- @@ -147,7 +147,7 @@ function gcc_build
- patch_gcc13_1_0_libiberty_strsignal_psignal_prototype
- # original mkinstalldirs cannot handle UNC paths
- - printf '#!/bin/sh\n# original mkinstalldirs cannot handle Cygwin UNC paths\nmkdir -p "$@"\nexit $?' >'mkinstalldirs'
- + printf '#!/bin/sh\n# original mkinstalldirs cannot handle Cygwin UNC paths\nmkdir -p "$@"\nexit $?\n' >'mkinstalldirs'
- chmod a+x 'mkinstalldirs'
- # Cygwin/MSYS2: workaround for configure using cp -p where ln -s should be used
- @@ -321,7 +321,7 @@ function bash_build
- #
- # original mkinstalldirs cannot handle UNC paths
- - printf '#!/bin/sh\n# original mkinstalldirs cannot handle Cygwin UNC paths\nmkdir -p "$@"\nexit $?' >'support/mkinstalldirs'
- + printf '#!/bin/sh\n# original mkinstalldirs cannot handle Cygwin UNC paths\nmkdir -p "$@"\nexit $?\n' >'mkinstalldirs'
- chmod a+x 'support/mkinstalldirs'
- # disable loadable plugins
- --
- 2.45.1
msnfs41client: Patch for FATTR4 enum sign issue, implementing FATTR4_WORD2_CLONE_BLKSIZE+misc, 2025-04-26
Posted by Anonymous on Sat 26th Apr 2025 21:08
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.