diff --git a/0001-xfs-correct-nlink-printf-specifier-from-hd-to-PRIu32.patch b/0001-xfs-correct-nlink-printf-specifier-from-hd-to-PRIu32.patch deleted file mode 100644 index 1f3b65c..0000000 --- a/0001-xfs-correct-nlink-printf-specifier-from-hd-to-PRIu32.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 8f9d8d38f2c4cea10d82d62286e6caa837d1bfd6 Mon Sep 17 00:00:00 2001 -From: hexiaole -Date: Wed, 13 Jul 2022 20:58:24 -0500 -Subject: [PATCH] xfs: correct nlink printf specifier from hd to PRIu32 - -1. Description -libxfs/xfs_log_format.h declare 'di_nlink' as unsigned 32-bit integer: - -typedef struct xfs_icdinode { - ... - __uint32_t di_nlink; /* number of links to file */ - ... -} xfs_icdinode_t; - -But logprint/log_misc.c use '%hd' to print 'di_nlink': - -void -xlog_print_trans_inode_core(xfs_icdinode_t *ip) -{ - ... - printf(_("nlink %hd uid %d gid %d\n"), - ip->di_nlink, ip->di_uid, ip->di_gid); - ... -} - -'%hd' can be 16-bit on many architectures, on these architectures, the 'printf' only print the low 16-bit of 'di_nlink'. - -2. Reproducer -2.1. Commands -[root@localhost ~]# cd -[root@localhost ~]# xfs_mkfile 128m 128m.xfs -[root@localhost ~]# mkfs.xfs 128m.xfs -[root@localhost ~]# mount 128m.xfs /mnt/ -[root@localhost ~]# cd /mnt/ -[root@localhost mnt]# seq 1 65534|xargs mkdir -p -[root@localhost mnt]# cd -[root@localhost ~]# umount /mnt/ -[root@localhost ~]# xfs_logprint 128m.xfs|grep nlink|tail -1 - -2.2. Expect result -nlink 65536 - -2.3. Actual result -nlink 0 - -Signed-off-by: hexiaole -Reviewed-by: Darrick J. Wong -Reviewed-by: Christoph Hellwig -Signed-off-by: Eric Sandeen ---- - logprint/log_misc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/logprint/log_misc.c b/logprint/log_misc.c -index 35e926a..6add28e 100644 ---- a/logprint/log_misc.c -+++ b/logprint/log_misc.c -@@ -444,7 +444,7 @@ xlog_print_trans_inode_core( - printf(_("magic 0x%hx mode 0%ho version %d format %d\n"), - ip->di_magic, ip->di_mode, (int)ip->di_version, - (int)ip->di_format); -- printf(_("nlink %hd uid %d gid %d\n"), -+ printf(_("nlink %" PRIu32 " uid %d gid %d\n"), - ip->di_nlink, ip->di_uid, ip->di_gid); - printf(_("atime 0x%llx mtime 0x%llx ctime 0x%llx\n"), - xlog_extract_dinode_ts(ip->di_atime), --- -2.27.0 - diff --git a/0004-xfsprogs-Add-sw64-architecture.patch b/0001-xfsprogs-Add-sw64-architecture.patch similarity index 100% rename from 0004-xfsprogs-Add-sw64-architecture.patch rename to 0001-xfsprogs-Add-sw64-architecture.patch diff --git a/0002-libxfs-fix-inode-reservation-space-for-removing-tran.patch b/0002-libxfs-fix-inode-reservation-space-for-removing-tran.patch deleted file mode 100644 index 2389794..0000000 --- a/0002-libxfs-fix-inode-reservation-space-for-removing-tran.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0af83349e54583a41f157edebb0055e14c029355 Mon Sep 17 00:00:00 2001 -From: hexiaole -Date: Tue, 2 Aug 2022 11:08:47 +0800 -Subject: [PATCH] libxfs: fix inode reservation space for removing transaction - -In 'libxfs/xfs_trans_resv.c', the comment for transaction of removing a -directory entry mentions that there has 2 inode size of space to be -reserverd, but the actual code only count for 1 inode size: - -/* libxfs/xfs_trans_resv.c begin */ -/* - * For removing a directory entry we can modify: - * the parent directory inode: inode size - * the removed inode: inode size -... -xfs_calc_remove_reservation( - struct xfs_mount *mp) -{ - return XFS_DQUOT_LOGRES(mp) + - xfs_calc_iunlink_add_reservation(mp) + - max((xfs_calc_inode_res(mp, 1) + -... -/* libxfs/xfs_trans_resv.c end */ - -Here only count for 1 inode size to be reserved in -'xfs_calc_inode_res(mp, 1)', rather than 2. - -Signed-off-by: hexiaole ---- - libxfs/xfs_trans_resv.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libxfs/xfs_trans_resv.c b/libxfs/xfs_trans_resv.c -index 9ce7d8f..7638ef9 100644 ---- a/libxfs/xfs_trans_resv.c -+++ b/libxfs/xfs_trans_resv.c -@@ -422,7 +422,7 @@ xfs_calc_remove_reservation( - { - return XFS_DQUOT_LOGRES(mp) + - xfs_calc_iunlink_add_reservation(mp) + -- max((xfs_calc_inode_res(mp, 1) + -+ max((xfs_calc_inode_res(mp, 2) + - xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), - XFS_FSB_TO_B(mp, 1))), - (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) + --- -2.27.0 - diff --git a/0003-mkfs-prevent-corruption-of-passed-in-suboption-strin.patch b/0003-mkfs-prevent-corruption-of-passed-in-suboption-strin.patch deleted file mode 100644 index 1b7564c..0000000 --- a/0003-mkfs-prevent-corruption-of-passed-in-suboption-strin.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 99c7877759c0d0e7cd1b386c717e25dbc6f5ce61 Mon Sep 17 00:00:00 2001 -From: "Darrick J. Wong" -Date: Fri, 25 Feb 2022 17:42:16 -0500 -Subject: [PATCH] mkfs: prevent corruption of passed-in suboption string values - -Eric and I were trying to play with mkfs.configuration files, when I -spotted this (with the libini package from Ubuntu 20.04): - -# cat << EOF > /tmp/r -[data] -su=2097152 -sw=1 -EOF -# mkfs.xfs -f -c options=/tmp/r /dev/sda -Parameters parsed from config file /tmp/r successfully --d su option requires a value - -It turns out that libini's parser uses stack variables(!) to store the -value of a key=value pair that it parses, and passes this stack array to -the parse_cfgopt function. If the particular option calls getstr(), -then we save the value of that pointer (not its contents) to the -cli_params. Being a stack array, the contents will be overwritten by -other function calls, which means that our value of '2097152' has been -destroyed by the time we actually call getnum when we're validating the -new fs config. - -We never noticed this until now because the only other caller was -getsubopt on the argv array, which gets chopped up but left intact in -memory. The solution is to make a private copy of those strings if we -ever save them for later. For now we'll be lazy and let the memory -leak, since mkfs is not a long-running process. - -Fixes: 33c62516 ("mkfs: add initial ini format config file parsing support") -Signed-off-by: Darrick J. Wong -Reviewed-by: Christoph Hellwig -Signed-off-by: Eric Sandeen ---- - mkfs/xfs_mkfs.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c -index 3a41e17f..fcad6b55 100644 ---- a/mkfs/xfs_mkfs.c -+++ b/mkfs/xfs_mkfs.c -@@ -1438,12 +1438,21 @@ getstr( - struct opt_params *opts, - int index) - { -+ char *ret; -+ - check_opt(opts, index, true); - - /* empty strings for string options are not valid */ - if (!str || *str == '\0') - reqval(opts->name, opts->subopts, index); -- return (char *)str; -+ -+ ret = strdup(str); -+ if (!ret) { -+ fprintf(stderr, _("Out of memory while saving suboptions.\n")); -+ exit(1); -+ } -+ -+ return ret; - } - - static int --- -2.35.3 - diff --git a/xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch b/xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch index f5643fa..b0be611 100644 --- a/xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch +++ b/xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch @@ -1,26 +1,17 @@ ---- xfsprogs-5.12.0.orig/man/man8/mkfs.xfs.8 -+++ xfsprogs-5.12.0/man/man8/mkfs.xfs.8 -@@ -203,7 +203,7 @@ December 1901 to January 2038, and quota - .IP - By default, - .B mkfs.xfs --will not enable this feature. -+in openeuler will enable this feature. - If the option - .B \-m crc=0 - is used, the large timestamp feature is not supported and is disabled. -@@ -256,7 +256,7 @@ This can be used to reduce mount times w - .IP - By default, - .B mkfs.xfs --will not enable this option. -+in openeuler will enable this option. - This feature is only available for filesystems created with the (default) - .B \-m finobt=1 - option set. ---- xfsprogs-5.12.0.orig/mkfs/xfs_mkfs.c -+++ xfsprogs-5.12.0/mkfs/xfs_mkfs.c -@@ -3795,6 +3797,23 @@ cfgfile_parse( +diff --git a/mkfs/xfs_mkfs.c b/../xfs_mkfs.c.bak +index 9dd0e79..49e3224 100644 +--- a/mkfs/xfs_mkfs.c ++++ b/../xfs_mkfs.c.bak +@@ -13,6 +13,8 @@ + #include "libfrog/crc32cselftest.h" + #include "proto.h" + #include ++#include ++#include + + #define TERABYTES(count, blog) ((uint64_t)(count) << (40 - (blog))) + #define GIGABYTES(count, blog) ((uint64_t)(count) << (30 - (blog))) +@@ -3998,6 +4000,23 @@ cfgfile_parse( cli->cfgfile); } @@ -44,42 +35,19 @@ int main( int argc, -@@ -3848,17 +3867,25 @@ main( - .spinodes = true, - .rmapbt = false, - .reflink = true, -- .inobtcnt = false, -+ .inobtcnt = true, - .parent_pointers = false, - .nodalign = false, - .nortalign = false, -- .bigtime = false, -+ .bigtime = true, - }, +@@ -4077,7 +4096,15 @@ main( }; struct list_head buffer_list; + unsigned int kver; int error; - ++ + /* turn bigtime & inobtcnt back off if running under older kernels */ + kver = get_system_kver(); + if (kver < KERNEL_VERSION(5,10,0)) { + dft.sb_feat.inobtcnt = false; + dft.sb_feat.bigtime = false; + } -+ + platform_uuid_generate(&cli.uuid); progname = basename(argv[0]); - setlocale(LC_ALL, ""); ---- xfsprogs-5.14.0/mkfs/xfs_mkfs.c.orig -+++ xfsprogs-5.14.0/mkfs/xfs_mkfs.c -@@ -12,6 +12,8 @@ - #include "libfrog/convert.h" - #include "proto.h" - #include -+#include -+#include - - #define TERABYTES(count, blog) ((uint64_t)(count) << (40 - (blog))) - #define GIGABYTES(count, blog) ((uint64_t)(count) << (30 - (blog))) diff --git a/xfsprogs-5.14.1.tar.xz b/xfsprogs-5.14.1.tar.xz deleted file mode 100644 index 7edc9c4..0000000 Binary files a/xfsprogs-5.14.1.tar.xz and /dev/null differ diff --git a/xfsprogs-6.0.0.tar.xz b/xfsprogs-6.0.0.tar.xz new file mode 100644 index 0000000..2b4d40c Binary files /dev/null and b/xfsprogs-6.0.0.tar.xz differ diff --git a/xfsprogs.spec b/xfsprogs.spec index f686bcb..42451d7 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs -Version: 5.14.1 -Release: 6 +Version: 6.0.0 +Release: 1 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -18,10 +18,7 @@ Obsoletes: xfsprogs-qa-devel <= %{version} Conflicts: xfsdump < 3.0.1 Patch0: xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch -Patch1: 0001-xfs-correct-nlink-printf-specifier-from-hd-to-PRIu32.patch -Patch2: 0002-libxfs-fix-inode-reservation-space-for-removing-tran.patch -Patch3: 0003-mkfs-prevent-corruption-of-passed-in-suboption-strin.patch -Patch4: 0004-xfsprogs-Add-sw64-architecture.patch +Patch1: 0001-xfsprogs-Add-sw64-architecture.patch %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -83,6 +80,7 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %{_usr}/%{_lib}/xfsprogs/* %{_sbindir}/* %{_unitdir}/* +%{_datadir}/xfsprogs/mkfs/*.conf %exclude %{_sbindir}/xfs_scrub* %exclude %{_unitdir}/xfs_scrub* %exclude %{_usr}/%{_lib}/xfsprogs/xfs_scrub* @@ -105,6 +103,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Sat Nov 19 2022 wuguanghao - 6.0.0-1 +- upgrade version to 6.0.0 + * Wed Oct 26 2022 wuzx - 5.14.1-6 - Add sw64 architecture