upgrade version to 6.0.0

This commit is contained in:
wguanghao 2022-11-19 17:53:48 +08:00
parent 6f533b0c54
commit 834d798b31
8 changed files with 24 additions and 242 deletions

View File

@ -1,69 +0,0 @@
From 8f9d8d38f2c4cea10d82d62286e6caa837d1bfd6 Mon Sep 17 00:00:00 2001
From: hexiaole <hexiaole@kylinos.cn>
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 <hexiaole@kylinos.cn>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
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

View File

@ -1,48 +0,0 @@
From 0af83349e54583a41f157edebb0055e14c029355 Mon Sep 17 00:00:00 2001
From: hexiaole <hexiaole@kylinos.cn>
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 <hexiaole@kylinos.cn>
---
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

View File

@ -1,70 +0,0 @@
From 99c7877759c0d0e7cd1b386c717e25dbc6f5ce61 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <djwong@kernel.org>
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 <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
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

View File

@ -1,26 +1,17 @@
--- xfsprogs-5.12.0.orig/man/man8/mkfs.xfs.8 diff --git a/mkfs/xfs_mkfs.c b/../xfs_mkfs.c.bak
+++ xfsprogs-5.12.0/man/man8/mkfs.xfs.8 index 9dd0e79..49e3224 100644
@@ -203,7 +203,7 @@ December 1901 to January 2038, and quota --- a/mkfs/xfs_mkfs.c
.IP +++ b/../xfs_mkfs.c.bak
By default, @@ -13,6 +13,8 @@
.B mkfs.xfs #include "libfrog/crc32cselftest.h"
-will not enable this feature. #include "proto.h"
+in openeuler will enable this feature. #include <ini.h>
If the option +#include <linux/version.h>
.B \-m crc=0 +#include <sys/utsname.h>
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 #define TERABYTES(count, blog) ((uint64_t)(count) << (40 - (blog)))
.IP #define GIGABYTES(count, blog) ((uint64_t)(count) << (30 - (blog)))
By default, @@ -3998,6 +4000,23 @@ cfgfile_parse(
.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(
cli->cfgfile); cli->cfgfile);
} }
@ -44,42 +35,19 @@
int int
main( main(
int argc, int argc,
@@ -3848,17 +3867,25 @@ main( @@ -4077,7 +4096,15 @@ main(
.spinodes = true,
.rmapbt = false,
.reflink = true,
- .inobtcnt = false,
+ .inobtcnt = true,
.parent_pointers = false,
.nodalign = false,
.nortalign = false,
- .bigtime = false,
+ .bigtime = true,
},
}; };
struct list_head buffer_list; struct list_head buffer_list;
+ unsigned int kver; + unsigned int kver;
int error; int error;
+
+ /* turn bigtime & inobtcnt back off if running under older kernels */ + /* turn bigtime & inobtcnt back off if running under older kernels */
+ kver = get_system_kver(); + kver = get_system_kver();
+ if (kver < KERNEL_VERSION(5,10,0)) { + if (kver < KERNEL_VERSION(5,10,0)) {
+ dft.sb_feat.inobtcnt = false; + dft.sb_feat.inobtcnt = false;
+ dft.sb_feat.bigtime = false; + dft.sb_feat.bigtime = false;
+ } + }
+
platform_uuid_generate(&cli.uuid); platform_uuid_generate(&cli.uuid);
progname = basename(argv[0]); 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 <ini.h>
+#include <linux/version.h>
+#include <sys/utsname.h>
#define TERABYTES(count, blog) ((uint64_t)(count) << (40 - (blog)))
#define GIGABYTES(count, blog) ((uint64_t)(count) << (30 - (blog)))

Binary file not shown.

BIN
xfsprogs-6.0.0.tar.xz Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
Name: xfsprogs Name: xfsprogs
Version: 5.14.1 Version: 6.0.0
Release: 6 Release: 1
Summary: Administration and debugging tools for the XFS file system Summary: Administration and debugging tools for the XFS file system
License: GPL+ and LGPLv2+ License: GPL+ and LGPLv2+
URL: https://xfs.wiki.kernel.org URL: https://xfs.wiki.kernel.org
@ -18,10 +18,7 @@ Obsoletes: xfsprogs-qa-devel <= %{version}
Conflicts: xfsdump < 3.0.1 Conflicts: xfsdump < 3.0.1
Patch0: xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch Patch0: xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch
Patch1: 0001-xfs-correct-nlink-printf-specifier-from-hd-to-PRIu32.patch Patch1: 0001-xfsprogs-Add-sw64-architecture.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
%description %description
xfsprogs are the userspace utilities that manage XFS filesystems. xfsprogs are the userspace utilities that manage XFS filesystems.
@ -83,6 +80,7 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/
%{_usr}/%{_lib}/xfsprogs/* %{_usr}/%{_lib}/xfsprogs/*
%{_sbindir}/* %{_sbindir}/*
%{_unitdir}/* %{_unitdir}/*
%{_datadir}/xfsprogs/mkfs/*.conf
%exclude %{_sbindir}/xfs_scrub* %exclude %{_sbindir}/xfs_scrub*
%exclude %{_unitdir}/xfs_scrub* %exclude %{_unitdir}/xfs_scrub*
%exclude %{_usr}/%{_lib}/xfsprogs/xfs_scrub* %exclude %{_usr}/%{_lib}/xfsprogs/xfs_scrub*
@ -105,6 +103,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/
%changelog %changelog
* Sat Nov 19 2022 wuguanghao <wuguanghao3@huawei.com> - 6.0.0-1
- upgrade version to 6.0.0
* Wed Oct 26 2022 wuzx<wuzx1226@qq.com> - 5.14.1-6 * Wed Oct 26 2022 wuzx<wuzx1226@qq.com> - 5.14.1-6
- Add sw64 architecture - Add sw64 architecture