diff --git a/1001-xfsprogs-add-atomic-write-support.patch b/1001-xfsprogs-add-atomic-write-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..fb0328b03630c9bfc4ba2e1275eb3971e2283603 --- /dev/null +++ b/1001-xfsprogs-add-atomic-write-support.patch @@ -0,0 +1,53 @@ +From 78bef13e4a2e405469fddbaf66fbf3fd5df19607 Mon Sep 17 00:00:00 2001 +From: Joseph Qi +Date: Mon, 30 May 2022 15:11:22 +0800 +Subject: [PATCH 9/9] xfsprogs: add atomic write support + +Signed-off-by: Gao Xiang +Signed-off-by: Joseph Qi +--- + libxfs/xfs_format.h | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h +index e8e7e634..81f485fc 100644 +--- a/libxfs/xfs_format.h ++++ b/libxfs/xfs_format.h +@@ -450,11 +450,13 @@ xfs_sb_has_compat_feature( + #define XFS_SB_FEAT_RO_COMPAT_RMAPBT (1 << 1) /* reverse map btree */ + #define XFS_SB_FEAT_RO_COMPAT_REFLINK (1 << 2) /* reflinked files */ + #define XFS_SB_FEAT_RO_COMPAT_INOBTCNT (1 << 3) /* inobt block counts */ ++#define XFS_SB_FEAT_RO_COMPAT_ATOMIC_FILE (1 << 29) /* db atomic file */ + #define XFS_SB_FEAT_RO_COMPAT_ALL \ + (XFS_SB_FEAT_RO_COMPAT_FINOBT | \ + XFS_SB_FEAT_RO_COMPAT_RMAPBT | \ + XFS_SB_FEAT_RO_COMPAT_REFLINK| \ +- XFS_SB_FEAT_RO_COMPAT_INOBTCNT) ++ XFS_SB_FEAT_RO_COMPAT_INOBTCNT | \ ++ XFS_SB_FEAT_RO_COMPAT_ATOMIC_FILE) + #define XFS_SB_FEAT_RO_COMPAT_UNKNOWN ~XFS_SB_FEAT_RO_COMPAT_ALL + static inline bool + xfs_sb_has_ro_compat_feature( +@@ -1165,14 +1167,18 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) + #define XFS_DIFLAG2_COWEXTSIZE_BIT 2 /* copy on write extent size hint */ + #define XFS_DIFLAG2_BIGTIME_BIT 3 /* big timestamps */ + ++/* avoid using the highest bit 63 */ ++#define XFS_DIFLAG2_DIO_ATOMIC_WRITE_BIT 60 ++ + #define XFS_DIFLAG2_DAX (1 << XFS_DIFLAG2_DAX_BIT) + #define XFS_DIFLAG2_REFLINK (1 << XFS_DIFLAG2_REFLINK_BIT) + #define XFS_DIFLAG2_COWEXTSIZE (1 << XFS_DIFLAG2_COWEXTSIZE_BIT) + #define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT) ++#define XFS_DIFLAG2_DIO_ATOMIC_WRITE (1ULL << XFS_DIFLAG2_DIO_ATOMIC_WRITE_BIT) + + #define XFS_DIFLAG2_ANY \ + (XFS_DIFLAG2_DAX | XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE | \ +- XFS_DIFLAG2_BIGTIME) ++ XFS_DIFLAG2_BIGTIME | XFS_DIFLAG2_DIO_ATOMIC_WRITE) + + static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip) + { +-- +2.31.1 + diff --git a/xfsprogs-5.10.0.tar.xz b/xfsprogs-5.10.0.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..bc28cbd910e821b358369d9eedfc7611221cd25c Binary files /dev/null and b/xfsprogs-5.10.0.tar.xz differ diff --git a/xfsprogs-5.11.0-mkfs-fix-wrong-inobtcount-usage-error-output.patch b/xfsprogs-5.11.0-mkfs-fix-wrong-inobtcount-usage-error-output.patch new file mode 100644 index 0000000000000000000000000000000000000000..9d5b34f9f979319092b9459825cd8259f8e1989c --- /dev/null +++ b/xfsprogs-5.11.0-mkfs-fix-wrong-inobtcount-usage-error-output.patch @@ -0,0 +1,37 @@ +From 60056b93ba29c1837dacaee1550e0620a1f2b736 Mon Sep 17 00:00:00 2001 +From: Zorro Lang +Date: Fri, 12 Feb 2021 17:23:05 -0500 +Subject: [PATCH 1/9] mkfs: fix wrong inobtcount usage error output + +When mkfs fails, it shows: + ... + /* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,\n\ + inobtcnt=0|1,bigtime=0|1]\n\ + ... + +The "inobtcnt=0|1" is wrong usage, it must be inobtcount, there's not +an alias. To avoid misadvice, fix it. + +Signed-off-by: Zorro Lang +Reviewed-by: Eric Sandeen +Signed-off-by: Eric Sandeen +--- + mkfs/xfs_mkfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c +index 47acc127..0581843f 100644 +--- a/mkfs/xfs_mkfs.c ++++ b/mkfs/xfs_mkfs.c +@@ -928,7 +928,7 @@ usage( void ) + /* blocksize */ [-b size=num]\n\ + /* config file */ [-c options=xxx]\n\ + /* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,\n\ +- inobtcnt=0|1,bigtime=0|1]\n\ ++ inobtcount=0|1,bigtime=0|1]\n\ + /* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\ + (sunit=value,swidth=value|su=num,sw=num|noalign),\n\ + sectsize=num\n\ +-- +2.31.1 + diff --git a/xfsprogs-5.12.0-libfrog-report-inobtcount-in-geometry.patch b/xfsprogs-5.12.0-libfrog-report-inobtcount-in-geometry.patch new file mode 100644 index 0000000000000000000000000000000000000000..bd7dde87e3e60b7ab9cf3697f1956d79237c71ac --- /dev/null +++ b/xfsprogs-5.12.0-libfrog-report-inobtcount-in-geometry.patch @@ -0,0 +1,53 @@ +From 9f7aba4ba43c1f70e9e3909173122fb118671df1 Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Thu, 15 Apr 2021 15:44:10 -0400 +Subject: [PATCH 2/9] libfrog: report inobtcount in geometry + +Report the inode btree counter feature in fs feature reports. + +Signed-off-by: Darrick J. Wong +Reviewed-by: Christoph Hellwig +Signed-off-by: Eric Sandeen +--- + libfrog/fsgeom.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/libfrog/fsgeom.c b/libfrog/fsgeom.c +index 14507668..4f1a1842 100644 +--- a/libfrog/fsgeom.c ++++ b/libfrog/fsgeom.c +@@ -29,6 +29,7 @@ xfs_report_geom( + int rmapbt_enabled; + int reflink_enabled; + int bigtime_enabled; ++ int inobtcount; + + isint = geo->logstart > 0; + lazycount = geo->flags & XFS_FSOP_GEOM_FLAGS_LAZYSB ? 1 : 0; +@@ -45,12 +46,13 @@ xfs_report_geom( + rmapbt_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_RMAPBT ? 1 : 0; + reflink_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_REFLINK ? 1 : 0; + bigtime_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_BIGTIME ? 1 : 0; ++ inobtcount = geo->flags & XFS_FSOP_GEOM_FLAGS_INOBTCNT ? 1 : 0; + + printf(_( + "meta-data=%-22s isize=%-6d agcount=%u, agsize=%u blks\n" + " =%-22s sectsz=%-5u attr=%u, projid32bit=%u\n" + " =%-22s crc=%-8u finobt=%u, sparse=%u, rmapbt=%u\n" +-" =%-22s reflink=%-4u bigtime=%u\n" ++" =%-22s reflink=%-4u bigtime=%u inobtcount=%u\n" + "data =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n" + " =%-22s sunit=%-6u swidth=%u blks\n" + "naming =version %-14u bsize=%-6u ascii-ci=%d, ftype=%d\n" +@@ -60,7 +62,7 @@ xfs_report_geom( + mntpoint, geo->inodesize, geo->agcount, geo->agblocks, + "", geo->sectsize, attrversion, projid32bit, + "", crcs_enabled, finobt_enabled, spinodes, rmapbt_enabled, +- "", reflink_enabled, bigtime_enabled, ++ "", reflink_enabled, bigtime_enabled, inobtcount, + "", geo->blocksize, (unsigned long long)geo->datablocks, + geo->imaxpct, + "", geo->sunit, geo->swidth, +-- +2.31.1 + diff --git a/xfsprogs-5.12.0-libxfs-copy-crtime-correctly-now-that-it-s-timespec6.patch b/xfsprogs-5.12.0-libxfs-copy-crtime-correctly-now-that-it-s-timespec6.patch new file mode 100644 index 0000000000000000000000000000000000000000..a629e812c04d581f279b5bacb86a54218085b2d5 --- /dev/null +++ b/xfsprogs-5.12.0-libxfs-copy-crtime-correctly-now-that-it-s-timespec6.patch @@ -0,0 +1,34 @@ +From a93a2abe1d185eae394993f82c0280458476c597 Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Fri, 7 May 2021 10:42:17 -0400 +Subject: [PATCH 3/9] libxfs: copy crtime correctly now that it's timespec64 + +The incore i_mtime and di_crtime are both timespec64 now, which means +that tv_sec is a 64-bit value. Don't cast that to int32_t when we're +creating an inode, because we'll end up truncating the creation time +incorrectly, should an xfsprogs of this vintage make it to 2039. :P + +Signed-off-by: Darrick J. Wong +Reviewed-by: Christoph Hellwig +Signed-off-by: Eric Sandeen +--- + libxfs/util.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/libxfs/util.c b/libxfs/util.c +index 252cf91e..e63a5642 100644 +--- a/libxfs/util.c ++++ b/libxfs/util.c +@@ -310,8 +310,7 @@ libxfs_ialloc( + VFS_I(ip)->i_version = 1; + ip->i_d.di_flags2 = pip ? ip->i_mount->m_ino_geo.new_diflags2 : + xfs_flags2diflags2(ip, fsx->fsx_xflags); +- ip->i_d.di_crtime.tv_sec = (int32_t)VFS_I(ip)->i_mtime.tv_sec; +- ip->i_d.di_crtime.tv_nsec = (int32_t)VFS_I(ip)->i_mtime.tv_nsec; ++ ip->i_d.di_crtime = VFS_I(ip)->i_mtime; /* struct copy */ + ip->i_d.di_cowextsize = pip ? 0 : fsx->fsx_cowextsize; + } + +-- +2.31.1 + diff --git a/xfsprogs-5.12.0-libxfs-expose-inobtcount-in-xfs-geometry.patch b/xfsprogs-5.12.0-libxfs-expose-inobtcount-in-xfs-geometry.patch new file mode 100644 index 0000000000000000000000000000000000000000..cc951525021bddededfb8591331073be1307fd00 --- /dev/null +++ b/xfsprogs-5.12.0-libxfs-expose-inobtcount-in-xfs-geometry.patch @@ -0,0 +1,48 @@ +From cf1900135aa38c62615580c5972bd8d1d0252f61 Mon Sep 17 00:00:00 2001 +From: Zorro Lang +Date: Tue, 6 Apr 2021 16:56:32 -0400 +Subject: [PATCH 4/9] libxfs: expose inobtcount in xfs geometry + +Source kernel commit: bc41fa5321f93ecbabec177f888451cfc17ad66d + +As xfs supports the feature of inode btree block counters now, expose +this feature flag in xfs geometry, for userspace can check if the +inobtcnt is enabled or not. + +Signed-off-by: Zorro Lang +Reviewed-by: Darrick J. Wong +Signed-off-by: Darrick J. Wong +Signed-off-by: Eric Sandeen +--- + libxfs/xfs_fs.h | 1 + + libxfs/xfs_sb.c | 2 ++ + 2 files changed, 3 insertions(+) + +diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h +index 2a2e3cfd..6fad140d 100644 +--- a/libxfs/xfs_fs.h ++++ b/libxfs/xfs_fs.h +@@ -250,6 +250,7 @@ typedef struct xfs_fsop_resblks { + #define XFS_FSOP_GEOM_FLAGS_RMAPBT (1 << 19) /* reverse mapping btree */ + #define XFS_FSOP_GEOM_FLAGS_REFLINK (1 << 20) /* files can share blocks */ + #define XFS_FSOP_GEOM_FLAGS_BIGTIME (1 << 21) /* 64-bit nsec timestamps */ ++#define XFS_FSOP_GEOM_FLAGS_INOBTCNT (1 << 22) /* inobt btree counter */ + + /* + * Minimum and maximum sizes need for growth checks. +diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c +index fb2212b8..a5ab0211 100644 +--- a/libxfs/xfs_sb.c ++++ b/libxfs/xfs_sb.c +@@ -1145,6 +1145,8 @@ xfs_fs_geometry( + geo->flags |= XFS_FSOP_GEOM_FLAGS_REFLINK; + if (xfs_sb_version_hasbigtime(sbp)) + geo->flags |= XFS_FSOP_GEOM_FLAGS_BIGTIME; ++ if (xfs_sb_version_hasinobtcounts(sbp)) ++ geo->flags |= XFS_FSOP_GEOM_FLAGS_INOBTCNT; + if (xfs_sb_version_hassector(sbp)) + geo->logsectsize = sbp->sb_logsectsize; + else +-- +2.31.1 + diff --git a/xfsprogs-5.13.0-xfs-remove-the-unused-xfs_icdinode_has_bigtime-helpe.patch b/xfsprogs-5.13.0-xfs-remove-the-unused-xfs_icdinode_has_bigtime-helpe.patch new file mode 100644 index 0000000000000000000000000000000000000000..9433eadbdc0efd3271f140706dd055aee36fe973 --- /dev/null +++ b/xfsprogs-5.13.0-xfs-remove-the-unused-xfs_icdinode_has_bigtime-helpe.patch @@ -0,0 +1,34 @@ +From a7f8000c449bef5ac545ef7a31a5cae4032359c5 Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig +Date: Wed, 30 Jun 2021 18:29:41 -0400 +Subject: [PATCH 5/9] xfs: remove the unused xfs_icdinode_has_bigtime helper + +Source kernel commit: 55f773380e922d3b975a7acb24331c76611cce30 + +Signed-off-by: Christoph Hellwig +Reviewed-by: Darrick J. Wong +Signed-off-by: Darrick J. Wong +Signed-off-by: Eric Sandeen +--- + libxfs/xfs_inode_buf.h | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h +index ef5eaf33..3888a7e9 100644 +--- a/libxfs/xfs_inode_buf.h ++++ b/libxfs/xfs_inode_buf.h +@@ -32,11 +32,6 @@ struct xfs_icdinode { + struct timespec64 di_crtime; /* time created */ + }; + +-static inline bool xfs_icdinode_has_bigtime(const struct xfs_icdinode *icd) +-{ +- return icd->di_flags2 & XFS_DIFLAG2_BIGTIME; +-} +- + /* + * Inode location information. Stored in the inode and passed to + * xfs_imap_to_bp() to get a buffer and dinode for a given inode. +-- +2.31.1 + diff --git a/xfsprogs-5.13.0-xfs-rename-struct-xfs_legacy_ictimestamp.patch b/xfsprogs-5.13.0-xfs-rename-struct-xfs_legacy_ictimestamp.patch new file mode 100644 index 0000000000000000000000000000000000000000..59b033f14176672416be16135faa93a08dd1a18a --- /dev/null +++ b/xfsprogs-5.13.0-xfs-rename-struct-xfs_legacy_ictimestamp.patch @@ -0,0 +1,52 @@ +From e5b8c29a68484db709218d33756c7839e979a5d8 Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig +Date: Wed, 30 Jun 2021 18:38:58 -0400 +Subject: [PATCH 6/9] xfs: rename struct xfs_legacy_ictimestamp + +Source kernel commit: 732de7dbdbd30df40a6d260a8da6fc5262039439 + +Rename struct xfs_legacy_ictimestamp to struct xfs_log_legacy_timestamp +as it is a type used for logging timestamps with no relationship to the +in-core inode. + +Signed-off-by: Christoph Hellwig +Reviewed-by: Darrick J. Wong +Signed-off-by: Darrick J. Wong +Signed-off-by: Eric Sandeen +--- + libxfs/xfs_log_format.h | 2 +- + logprint/log_misc.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libxfs/xfs_log_format.h b/libxfs/xfs_log_format.h +index 8bd00da6..101b9730 100644 +--- a/libxfs/xfs_log_format.h ++++ b/libxfs/xfs_log_format.h +@@ -371,7 +371,7 @@ static inline int xfs_ilog_fdata(int w) + typedef uint64_t xfs_ictimestamp_t; + + /* Legacy timestamp encoding format. */ +-struct xfs_legacy_ictimestamp { ++struct xfs_log_legacy_timestamp { + int32_t t_sec; /* timestamp seconds */ + int32_t t_nsec; /* timestamp nanoseconds */ + }; +diff --git a/logprint/log_misc.c b/logprint/log_misc.c +index afcd2cee..5a145f94 100644 +--- a/logprint/log_misc.c ++++ b/logprint/log_misc.c +@@ -745,9 +745,9 @@ time64_t + xlog_extract_dinode_ts( + const xfs_ictimestamp_t its) + { +- struct xfs_legacy_ictimestamp *lits; ++ struct xfs_log_legacy_timestamp *lits; + +- lits = (struct xfs_legacy_ictimestamp *)&its; ++ lits = (struct xfs_log_legacy_timestamp *)&its; + return (time64_t)lits->t_sec; + } + +-- +2.31.1 + diff --git a/xfsprogs-5.13.0-xfs-rename-xfs_ictimestamp_t.patch b/xfsprogs-5.13.0-xfs-rename-xfs_ictimestamp_t.patch new file mode 100644 index 0000000000000000000000000000000000000000..b02c037bc7d71ccbc8b10286057a989a3bed29eb --- /dev/null +++ b/xfsprogs-5.13.0-xfs-rename-xfs_ictimestamp_t.patch @@ -0,0 +1,84 @@ +From 6bdc300abe56ae82ebd640b2b26c696032045d82 Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig +Date: Wed, 30 Jun 2021 18:38:58 -0400 +Subject: [PATCH 7/9] xfs: rename xfs_ictimestamp_t + +Source kernel commit: 6fc277c7c935c7e1fdee23e82da988d9d3cb6bef + +Rename xfs_ictimestamp_t to xfs_log_timestamp_t as it is a type used +for logging timestamps with no relationship to the in-core inode. + +Signed-off-by: Christoph Hellwig +Reviewed-by: Darrick J. Wong +Signed-off-by: Darrick J. Wong +Signed-off-by: Eric Sandeen +--- + libxfs/xfs_log_format.h | 10 +++++----- + logprint/log_misc.c | 2 +- + logprint/logprint.h | 2 +- + 3 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/libxfs/xfs_log_format.h b/libxfs/xfs_log_format.h +index 101b9730..3e15ea29 100644 +--- a/libxfs/xfs_log_format.h ++++ b/libxfs/xfs_log_format.h +@@ -368,7 +368,7 @@ static inline int xfs_ilog_fdata(int w) + * directly mirrors the xfs_dinode structure as it must contain all the same + * information. + */ +-typedef uint64_t xfs_ictimestamp_t; ++typedef uint64_t xfs_log_timestamp_t; + + /* Legacy timestamp encoding format. */ + struct xfs_log_legacy_timestamp { +@@ -393,9 +393,9 @@ struct xfs_log_dinode { + uint16_t di_projid_hi; /* higher part of owner's project id */ + uint8_t di_pad[6]; /* unused, zeroed space */ + uint16_t di_flushiter; /* incremented on flush */ +- xfs_ictimestamp_t di_atime; /* time last accessed */ +- xfs_ictimestamp_t di_mtime; /* time last modified */ +- xfs_ictimestamp_t di_ctime; /* time created/inode modified */ ++ xfs_log_timestamp_t di_atime; /* time last accessed */ ++ xfs_log_timestamp_t di_mtime; /* time last modified */ ++ xfs_log_timestamp_t di_ctime; /* time created/inode modified */ + xfs_fsize_t di_size; /* number of bytes in file */ + xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */ + xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ +@@ -420,7 +420,7 @@ struct xfs_log_dinode { + uint8_t di_pad2[12]; /* more padding for future expansion */ + + /* fields only written to during inode creation */ +- xfs_ictimestamp_t di_crtime; /* time created */ ++ xfs_log_timestamp_t di_crtime; /* time created */ + xfs_ino_t di_ino; /* inode number */ + uuid_t di_uuid; /* UUID of the filesystem */ + +diff --git a/logprint/log_misc.c b/logprint/log_misc.c +index 5a145f94..35e926a3 100644 +--- a/logprint/log_misc.c ++++ b/logprint/log_misc.c +@@ -743,7 +743,7 @@ xlog_print_trans_icreate( + + time64_t + xlog_extract_dinode_ts( +- const xfs_ictimestamp_t its) ++ const xfs_log_timestamp_t its) + { + struct xfs_log_legacy_timestamp *lits; + +diff --git a/logprint/logprint.h b/logprint/logprint.h +index 248fe7bf..38a7d3fa 100644 +--- a/logprint/logprint.h ++++ b/logprint/logprint.h +@@ -18,7 +18,7 @@ extern int print_no_data; + extern int print_no_print; + + /* exports */ +-extern time64_t xlog_extract_dinode_ts(const xfs_ictimestamp_t); ++extern time64_t xlog_extract_dinode_ts(const xfs_log_timestamp_t); + extern void xlog_print_lseek(struct xlog *, int, xfs_daddr_t, int); + + extern void xfs_log_copy(struct xlog *, int, char *); +-- +2.31.1 + diff --git a/xfsprogs-5.18.0-mkfs-don-t-trample-the-gid-set-in-the-protofile.patch b/xfsprogs-5.18.0-mkfs-don-t-trample-the-gid-set-in-the-protofile.patch new file mode 100644 index 0000000000000000000000000000000000000000..bc1ce723cb13223e05030c71f8addf0412794485 --- /dev/null +++ b/xfsprogs-5.18.0-mkfs-don-t-trample-the-gid-set-in-the-protofile.patch @@ -0,0 +1,87 @@ +From d83d6254548ef26fec8b4605d67161a467d8e779 Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Tue, 17 May 2022 22:48:13 -0400 +Subject: [PATCH 8/9] mkfs: don't trample the gid set in the protofile + +Catherine's recent changes to xfs/019 exposed a bug in how libxfs +handles setgid bits. mkfs reads the desired gid in from the protofile, +but if the parent directory is setgid, it will override the user's +setting and (re)set the child's gid to the parent's gid. Overriding +user settings is (probably) not the desired mode of operation, so create +a flag to struct cred to force the gid in the protofile. + +It looks like this has been broken since ~2005. + +Cc: Catherine Hoang +Fixes: 9f064b7e ("Provide mkfs options to easily exercise all inheritable attributes, esp. the extsize allocator hint. Merge of master-melb:xfs-cmds:24370a by kenmcd.") +Signed-off-by: Darrick J. Wong +Reviewed-by: Catherine Hoang +Reviewed-by: Christoph Hellwig +Reviewed-by: Christoph Hellwig +Signed-off-by: Eric Sandeen +--- + include/xfs_inode.h | 11 +++++++---- + libxfs/util.c | 3 ++- + mkfs/proto.c | 3 ++- + 3 files changed, 11 insertions(+), 6 deletions(-) + +diff --git a/include/xfs_inode.h b/include/xfs_inode.h +index 742aebc8..506567e5 100644 +--- a/include/xfs_inode.h ++++ b/include/xfs_inode.h +@@ -151,10 +151,13 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip) + return ip->i_d.di_flags2 & XFS_DIFLAG2_BIGTIME; + } + +-typedef struct cred { +- uid_t cr_uid; +- gid_t cr_gid; +-} cred_t; ++/* Always set the child's GID to this value, even if the parent is setgid. */ ++#define CRED_FORCE_GID (1U << 0) ++struct cred { ++ uid_t cr_uid; ++ gid_t cr_gid; ++ unsigned int cr_flags; ++}; + + extern int libxfs_inode_alloc (struct xfs_trans **, struct xfs_inode *, + mode_t, nlink_t, xfs_dev_t, struct cred *, +diff --git a/libxfs/util.c b/libxfs/util.c +index e63a5642..d151c514 100644 +--- a/libxfs/util.c ++++ b/libxfs/util.c +@@ -291,7 +291,8 @@ libxfs_ialloc( + xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG | XFS_ICHGTIME_MOD); + + if (pip && (VFS_I(pip)->i_mode & S_ISGID)) { +- VFS_I(ip)->i_gid = VFS_I(pip)->i_gid; ++ if (!(cr->cr_flags & CRED_FORCE_GID)) ++ VFS_I(ip)->i_gid = VFS_I(pip)->i_gid; + if ((VFS_I(pip)->i_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) + VFS_I(ip)->i_mode |= S_ISGID; + } +diff --git a/mkfs/proto.c b/mkfs/proto.c +index 0fa6ffb0..85e4bb3b 100644 +--- a/mkfs/proto.c ++++ b/mkfs/proto.c +@@ -377,7 +377,7 @@ parseproto( + xfs_trans_t *tp; + int val; + int isroot = 0; +- cred_t creds; ++ struct cred creds; + char *value; + struct xfs_name xname; + +@@ -445,6 +445,7 @@ parseproto( + mode |= val; + creds.cr_uid = (int)getnum(getstr(pp), 0, 0, false); + creds.cr_gid = (int)getnum(getstr(pp), 0, 0, false); ++ creds.cr_flags = CRED_FORCE_GID; + xname.name = (unsigned char *)name; + xname.len = name ? strlen(name) : 0; + xname.type = 0; +-- +2.31.1 + diff --git a/xfsprogs-5.19.0.tar.xz b/xfsprogs-5.19.0.tar.xz deleted file mode 100644 index a3c0427e9ba84e0dee508533ab31f185b93cb7d0..0000000000000000000000000000000000000000 Binary files a/xfsprogs-5.19.0.tar.xz and /dev/null differ diff --git a/xfsprogs.spec b/xfsprogs.spec index 389eb6c98afb05cf0b6e88c5951c3ee8d0e682e5..42a9d6629bceccb63d35ca96a570855a05e4ff47 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,7 +1,7 @@ %define anolis_release 1 Name: xfsprogs -Version: 5.19.0 +Version: 5.10.0 Release: %{anolis_release}%{?dist} Summary: Userspace utilities that manage XFS filesystems @@ -18,13 +18,29 @@ BuildRequires: libuuid-devel BuildRequires: libedit-devel BuildRequires: libblkid-devel BuildRequires: libicu -BuildRequires: systemd +BuildRequires: lvm2-devel BuildRequires: xz BuildRequires: inih-devel -BuildRequires: userspace-rcu-devel Provides: xfs-cmds Provides: xfsprogs-qa-devel Suggests: xfsprogs-xfs_scrub +Obsoletes: xfs-cmds <= %{version} +Obsoletes: xfsprogs-qa-devel <= %{version} +Conflicts: xfsdump < 3.0.1 + +# backport patch from upstream +Patch01: xfsprogs-5.11.0-mkfs-fix-wrong-inobtcount-usage-error-output.patch +Patch02: xfsprogs-5.12.0-libxfs-copy-crtime-correctly-now-that-it-s-timespec6.patch +Patch03: xfsprogs-5.12.0-libxfs-expose-inobtcount-in-xfs-geometry.patch +Patch04: xfsprogs-5.12.0-libfrog-report-inobtcount-in-geometry.patch +Patch05: xfsprogs-5.13.0-xfs-remove-the-unused-xfs_icdinode_has_bigtime-helpe.patch +Patch06: xfsprogs-5.13.0-xfs-rename-struct-xfs_legacy_ictimestamp.patch +Patch07: xfsprogs-5.13.0-xfs-rename-xfs_ictimestamp_t.patch +Patch08: xfsprogs-5.18.0-mkfs-don-t-trample-the-gid-set-in-the-protofile.patch + +# Begin: Anolis customized patches +Patch1001: 1001-xfsprogs-add-atomic-write-support.patch +# End: Anolis customized patches %description A set of commands to use the XFS file system, including mkfs.xfs. @@ -87,22 +103,29 @@ rm -f %{buildroot}/{%{_lib}/*.{la,a,so},%{_libdir}/*.{la,a}} # remove non-versioned docs location rm -rf %{buildroot}/%{_datadir}/doc/xfsprogs +%generate_compatibility_deps + +rm -rf %{buildroot}/%{abidir}/help + %find_lang %{name} %files -f %{name}.lang +%dir %{abidir} %{_libdir}/*.so.* +%{abidir}/*.dump %dir %{_usr}/%{_lib}/xfsprogs %{_usr}/%{_lib}/xfsprogs/* %{_mandir}/man5/* %{_mandir}/man8/* %{_sbindir}/* %{_unitdir}/* -%{_datadir}/xfsprogs/mkfs/*.conf +%{abidir}/*-option.list %exclude %{_sbindir}/xfs_scrub* %exclude %{_mandir}/man8/xfs_scrub* %exclude %{_usr}/%{_lib}/xfsprogs/xfs_scrub* %exclude %{_mandir}/man8/xfs_scrub_all* %exclude %{_unitdir}/xfs_scrub* +%exclude %{abidir}/xfs_scrub*-option.list %files doc %doc doc/CHANGES README @@ -113,6 +136,7 @@ rm -rf %{buildroot}/%{_datadir}/doc/xfsprogs %{_usr}/%{_lib}/xfsprogs/xfs_scrub* %{_mandir}/man8/xfs_scrub_all* %{_unitdir}/xfs_scrub* +%{abidir}/xfs_scrub*-option.list %files devel %{_mandir}/man2/* @@ -134,6 +158,11 @@ rm -rf %{buildroot}/%{_datadir}/doc/xfsprogs %{_libdir}/*.so %changelog +* Fri Oct 28 2022 Ziyang Zhang - 5.10.0-1 +- Rollback to 5.10.0 +- Add patches cherry-picked from upstream 5.10 to 5.18 +- Add Anolis customized atomic write support patches + * Fri Sep 23 2022 mgb01105731 - 5.19.0-1 - update to 5.19.0