diff --git a/SOURCES/bz1779806-mkfs_gfs2_Tighten_minimum_journal_size_checks.patch b/SOURCES/bz1779806-mkfs_gfs2_Tighten_minimum_journal_size_checks.patch new file mode 100644 index 0000000..c948e09 --- /dev/null +++ b/SOURCES/bz1779806-mkfs_gfs2_Tighten_minimum_journal_size_checks.patch @@ -0,0 +1,55 @@ +commit ea571e0e9f8f72b30732e1c2a43a09247c3eedd9 +Author: Andrew Price +Date: Fri Aug 28 11:30:24 2020 +0100 + + mkfs.gfs2: Tighten minimum journal size checks + + mkfs.gfs2 chooses the default journal size based on the block size and + the size of the target device, and when the device is small enough a + minimum journal size is enforced. If the block size is less than 4K and + the device is small enough a journal size can be chosen that is smaller + than the minimum and gfs2 will not mount it, as it has a hardcoded check + for >=8MB journals. To avoid that we can just clamp the journal size + back to 8MB in these cases. A validity check for the minimum has already + been done in default_journal_size(). + + Resolves: rhbz#1779806 + + Signed-off-by: Andrew Price + +diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c +index 3fb2eb92..df194dff 100644 +--- a/gfs2/mkfs/main_mkfs.c ++++ b/gfs2/mkfs/main_mkfs.c +@@ -929,11 +929,17 @@ static void sbd_init(struct gfs2_sbd *sdp, struct mkfs_opts *opts, unsigned bsiz + will fit. For user-provided journal sizes, limit it to half of the fs. */ + if (!opts->got_jsize) { + int default_jsize = default_journal_size(sdp->bsize, sdp->device.length / opts->journals); ++ unsigned jsize_mb; ++ + if (default_jsize < 0) { + fprintf(stderr, _("gfs2 will not fit on this device.\n")); + exit(1); + } +- opts->jsize = (default_jsize * sdp->bsize) >> 20; ++ jsize_mb = (default_jsize * sdp->bsize) >> 20; ++ if (jsize_mb < GFS2_MIN_JSIZE) ++ opts->jsize = GFS2_MIN_JSIZE; ++ else ++ opts->jsize = jsize_mb; + } else if ((((opts->jsize * opts->journals) << 20) / sdp->bsize) > (sdp->device.length / 2)) { + unsigned max_jsize = (sdp->device.length / 2 * sdp->bsize / opts->journals) >> 20; + +diff --git a/tests/mkfs.at b/tests/mkfs.at +index 96c4f6ab..73cdfee6 100644 +--- a/tests/mkfs.at ++++ b/tests/mkfs.at +@@ -78,6 +78,8 @@ AT_CLEANUP + AT_SETUP([Min. journal size]) + AT_KEYWORDS(mkfs.gfs2 mkfs) + GFS_FSCK_CHECK([$GFS_MKFS -p lock_nolock -J 8 $GFS_TGT]) ++GFS_FSCK_CHECK([$GFS_MKFS -p lock_nolock -b 1024 $GFS_TGT 511996]) ++AT_CHECK([gfs2_edit -p journal0 field di_size $GFS_TGT | tr -d '\n'], 0, [8388608], [ignore]) + AT_CLEANUP + + AT_SETUP([Max. quota change file size]) diff --git a/SPECS/gfs2-utils.spec b/SPECS/gfs2-utils.spec index dbadd01..0b74653 100644 --- a/SPECS/gfs2-utils.spec +++ b/SPECS/gfs2-utils.spec @@ -12,7 +12,7 @@ Name: gfs2-utils Version: 3.2.0 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2+ and LGPLv2+ Group: System Environment/Kernel Summary: Utilities for managing the global file system (GFS2) @@ -43,6 +43,7 @@ Patch6: bz1839219-mkfs_gfs2_Don_t_use_i_o_limits_hints_4K_for_block_size.patch Patch7: bz1833141-1-gfs2_jadd_Handle_out_of_space_issues.patch Patch8: bz1833141-2-gfs2_jadd_error_handling_overhaul.patch Patch9: bz1818983-gfs2_5_Update_some_mentions_of_gfs2_tool.patch +Patch10: bz1779806-mkfs_gfs2_Tighten_minimum_journal_size_checks.patch %prep %setup -q -n gfs2-utils-%{version} @@ -56,6 +57,7 @@ Patch9: bz1818983-gfs2_5_Update_some_mentions_of_gfs2_tool.patch %patch7 -p1 -b .bz1833141-1-gfs2_jadd_Handle_out_of_space_issues %patch8 -p1 -b .bz1833141-2-gfs2_jadd_error_handling_overhaul %patch9 -p1 -b .bz1818983-gfs2_5_Update_some_mentions_of_gfs2_tool +%patch10 -p1 -b .bz1779806-mkfs_gfs2_Tighten_minimum_journal_size_checks %build ./autogen.sh @@ -95,6 +97,10 @@ modifying, and correcting inconsistencies in GFS2 file systems. %{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules %changelog +* Thu Nov 12 2020 Andrew Price - 3.2.0-10 +- mkfs.gfs2: Tighten minimum journal size checks + Resolves: rhbz#1779806 + * Tue Jun 09 2020 Andrew Price - 3.2.0-9 - gfs2_jadd: Handle out-of-space issues - gfs2_jadd: error handling overhaul