From bf22a5fe4794a976fa47a7ca473101d3ada5617c Mon Sep 17 00:00:00 2001 From: eabdullin Date: Fri, 31 May 2024 16:39:40 +0000 Subject: [PATCH] Import from AlmaLinux stable repository --- .gfs2-utils.metadata | 1 - ...z2180782-mkfs_gfs2_Add_U_UUID_option.patch | 134 ++++++++++++++++++ SPECS/gfs2-utils.spec | 14 +- 3 files changed, 145 insertions(+), 4 deletions(-) delete mode 100644 .gfs2-utils.metadata create mode 100644 SOURCES/bz2180782-mkfs_gfs2_Add_U_UUID_option.patch diff --git a/.gfs2-utils.metadata b/.gfs2-utils.metadata deleted file mode 100644 index 7b4733e..0000000 --- a/.gfs2-utils.metadata +++ /dev/null @@ -1 +0,0 @@ -d08266389e4752fb53bd3297810296276ff395e5 SOURCES/gfs2-utils-3.2.0.tar.gz diff --git a/SOURCES/bz2180782-mkfs_gfs2_Add_U_UUID_option.patch b/SOURCES/bz2180782-mkfs_gfs2_Add_U_UUID_option.patch new file mode 100644 index 0000000..1e03b1b --- /dev/null +++ b/SOURCES/bz2180782-mkfs_gfs2_Add_U_UUID_option.patch @@ -0,0 +1,134 @@ +commit 60e7c2bfcb23ddfcf2f63d8d8a700e871071a574 +Author: Andrew Price +Date: Thu Jul 14 13:20:39 2022 +0100 + + mkfs.gfs2: Add -U UUID option + + Allow the user to specify the filesystem UUID, similar to mkfs.ext4's -U + option. + + Resolves: rhbz#2180782 + + Signed-off-by: Andrew Price + +diff --git a/gfs2/man/mkfs.gfs2.8 b/gfs2/man/mkfs.gfs2.8 +index 35e355a5..f4fd33f3 100644 +--- a/gfs2/man/mkfs.gfs2.8 ++++ b/gfs2/man/mkfs.gfs2.8 +@@ -120,6 +120,12 @@ unique file system name used to distinguish this gfs2 file system. Valid + \fIclustername\fRs and \fIlockspace\fRs may only contain alphanumeric + characters, hyphens (-) and underscores (_). + .TP ++\fB-U\fP \fIUUID\fR ++Specify the filesystem UUID. The argument must be string of hexadecimal digits ++separated by hyphens, of the form "1b4e28ba-2fa1-11d2-883f-b9a761bde3fb". If ++this option is omitted, the filesystem's UUID is randomly generated. Note that ++no attempt is made to prevent UUID clashes between filesystems. ++.TP + \fB-V\fP + Print program version information, then exit. + .TP +diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c +index 09e756fb..c661abae 100644 +--- a/gfs2/mkfs/main_mkfs.c ++++ b/gfs2/mkfs/main_mkfs.c +@@ -55,6 +55,7 @@ static void print_usage(const char *prog_name) + "-q", NULL, _("Don't print anything"), + "-r", _(""), _("Size of resource groups, in megabytes"), + "-t", _(""), _("Name of the lock table"), ++ "-U", _(""), _("The UUID of the file system"), + "-V", NULL, _("Display program version information, then exit"), + NULL, NULL, NULL /* Must be kept at the end */ + }; +@@ -122,6 +123,7 @@ struct mkfs_opts { + uint32_t journals; + const char *lockproto; + const char *locktable; ++ const char *uuid; + struct mkfs_dev dev; + unsigned discard:1; + +@@ -137,6 +139,7 @@ struct mkfs_opts { + unsigned got_locktable:1; + unsigned got_device:1; + unsigned got_topol:1; ++ unsigned got_uuid:1; + + unsigned override:1; + unsigned quiet:1; +@@ -321,7 +324,7 @@ static void opts_get(int argc, char *argv[], struct mkfs_opts *opts) + { + int c; + while (1) { +- c = getopt(argc, argv, "-b:c:DhJ:j:KOo:p:qr:t:V"); ++ c = getopt(argc, argv, "-b:c:DhJ:j:KOo:p:qr:t:U:V"); + if (c == -1) + break; + +@@ -373,6 +376,10 @@ static void opts_get(int argc, char *argv[], struct mkfs_opts *opts) + case 'o': + opt_parse_extended(optarg, opts); + break; ++ case 'U': ++ opts->uuid = optarg; ++ opts->got_uuid = 1; ++ break; + case 'V': + printf("mkfs.gfs2 %s (built %s %s)\n", VERSION, + __DATE__, __TIME__); +@@ -1030,6 +1037,28 @@ static void open_dev(struct mkfs_dev *dev, int withprobe) + exit(1); + } + ++static void sb_init(struct gfs2_sb *sb, unsigned bsize, struct mkfs_opts *opts) ++{ ++ memset(sb, 0, sizeof(struct gfs2_sb)); ++ sb->sb_header.mh_magic = GFS2_MAGIC; ++ sb->sb_header.mh_type = GFS2_METATYPE_SB; ++ sb->sb_header.mh_format = GFS2_FORMAT_SB; ++ sb->sb_fs_format = GFS2_FORMAT_FS; ++ sb->sb_multihost_format = GFS2_FORMAT_MULTI; ++ sb->sb_bsize = bsize; ++ sb->sb_bsize_shift = ffs(bsize) - 1; ++#ifdef GFS2_HAS_UUID ++ if (opts->got_uuid) { ++ int err = uuid_parse(opts->uuid, sb->sb_uuid); ++ if (err != 0) { ++ fprintf(stderr, _("Failed to parse UUID option.")); ++ exit(1); ++ } ++ } else ++ uuid_generate(sb->sb_uuid); ++#endif ++} ++ + int main(int argc, char *argv[]) + { + struct gfs2_sbd sbd; +@@ -1056,7 +1085,7 @@ int main(int argc, char *argv[]) + } + + sbd_init(&sbd, &opts, bsize); +- lgfs2_sb_init(&sb, bsize); ++ sb_init(&sb, bsize, &opts); + if (opts.debug) { + printf(_("File system options:\n")); + printf(" bsize = %u\n", sbd.bsize); +diff --git a/tests/mkfs.at b/tests/mkfs.at +index e7ce8e80..95e1aed2 100644 +--- a/tests/mkfs.at ++++ b/tests/mkfs.at +@@ -171,3 +171,13 @@ GFS_TGT_SIZE(64M) + AT_CHECK([$GFS_MKFS -p lock_nolock -j2 $GFS_TGT], 0, [ignore], [ignore]) + AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore]) + AT_CLEANUP ++ ++AT_SETUP([UUID option]) ++AT_KEYWORDS(mkfs.gfs2 mkfs) ++GFS_TGT_REGEN ++AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT -U], 1, [ignore], [ignore]) ++AT_CHECK([$GFS_MKFS -p lock_nolock -U 42 $GFS_TGT], 1, [ignore], [ignore]) ++AT_CHECK([$GFS_MKFS -p lock_nolock -U 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb4 $GFS_TGT], 1, [ignore], [ignore]) ++AT_CHECK([$GFS_MKFS -p lock_nolock -U 1b4e28ba-2fa1-11d2-883f-b9a761bde3f $GFS_TGT], 1, [ignore], [ignore]) ++GFS_FSCK_CHECK([$GFS_MKFS -p lock_nolock -U 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb $GFS_TGT]) ++AT_CLEANUP diff --git a/SPECS/gfs2-utils.spec b/SPECS/gfs2-utils.spec index 61ed698..122759a 100644 --- a/SPECS/gfs2-utils.spec +++ b/SPECS/gfs2-utils.spec @@ -12,7 +12,7 @@ Name: gfs2-utils Version: 3.2.0 -Release: 11%{?dist} +Release: 13%{?dist} License: GPLv2+ and LGPLv2+ Group: System Environment/Kernel Summary: Utilities for managing the global file system (GFS2) @@ -46,7 +46,7 @@ Patch9: bz1818983-gfs2_5_Update_some_mentions_of_gfs2_tool.patch Patch10: bz1779806-mkfs_gfs2_Tighten_minimum_journal_size_checks.patch Patch11: bz1942434-1-gfs2_jadd_Use_fallocate_to_preallocate_journals.patch Patch12: bz1942434-2-gfs2_jadd_Don_t_fsync_after_each_block_written.patch - +Patch13: bz2180782-mkfs_gfs2_Add_U_UUID_option.patch %prep %setup -q -n gfs2-utils-%{version} @@ -63,7 +63,7 @@ Patch12: bz1942434-2-gfs2_jadd_Don_t_fsync_after_each_block_written.patch %patch10 -p1 -b .bz1779806-mkfs_gfs2_Tighten_minimum_journal_size_checks %patch11 -p1 -b .bz1942434-1-gfs2_jadd_Use_fallocate_to_preallocate_journals %patch12 -p1 -b .bz1942434-2-gfs2_jadd_Don_t_fsync_after_each_block_written - +%patch13 -p1 -b .bz2180782-mkfs_gfs2_Add_U_UUID_option %build ./autogen.sh @@ -103,6 +103,14 @@ modifying, and correcting inconsistencies in GFS2 file systems. %{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules %changelog +* Tue Mar 28 2023 Andrew Price - 3.2.0-13 +- Re-add tests that were dropped in the c8s migration + Resolves: rhbz#2180782 + +* Tue Mar 28 2023 Andrew Price - 3.2.0-12 +- mkfs.gfs2: Add -U UUID option + Resolves: rhbz#2180782 + * Wed Mar 24 2021 Andrew Price - 3.2.0-11 - gfs2_jadd: Use fallocate to preallocate journals - gfs2_jadd: Don't fsync after each block written