Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

25 changed files with 7062 additions and 2248 deletions

6
.gitignore vendored
View File

@ -1 +1,5 @@
SOURCES/gfs2-utils-3.2.0.tar.gz
/gfs2-utils-3.3.0.tar.gz
/gfs2-utils-3.4.0.tar.gz
/gfs2-utils-3.4.1.tar.gz
/gfs2-utils-3.5.0.tar.gz
/gfs2-utils-3.5.1.tar.gz

View File

@ -0,0 +1,111 @@
commit f837169ab53dc915e10bdb480eaeb5bbb52c0c09
Author: Paul Evans <pevans@redhat.com>
Date: Wed Mar 6 12:28:16 2024 +0000
gfs2_edit: truncate to filesystem size at end of restoremeta()
Truncate to metadata header's filesystem size at the end of restore if
a header is present.
Resolves: RHEL-26661
Signed-off-by: Paul Evans <pevans@redhat.com>
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 4ee76be0..f5448974 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -1327,9 +1327,8 @@ static void restoremeta_usage(void)
fprintf(stderr, "gfs2_edit restoremeta <metadata_file> <block_device>\n");
}
-static int restore_init(const char *path, struct metafd *mfd, int printonly)
+static int restore_init(const char *path, struct metafd *mfd, struct savemeta *sm, int printonly)
{
- struct savemeta sm = {0};
struct gfs2_sb rsb;
uint16_t sb_siglen;
char *end;
@@ -1357,7 +1356,7 @@ static int restore_init(const char *path, struct metafd *mfd, int printonly)
return -1;
}
bp = restore_buf;
- ret = parse_header(bp, &sm);
+ ret = parse_header(bp, sm);
if (ret == 0) {
bp = restore_buf + sizeof(struct savemeta_header);
restore_off = sizeof(struct savemeta_header);
@@ -1383,10 +1382,10 @@ static int restore_init(const char *path, struct metafd *mfd, int printonly)
if (ret != 0)
return ret;
- if (sm.sm_fs_bytes > 0) {
- sbd.fssize = sm.sm_fs_bytes / sbd.sd_bsize;
+ if (sm->sm_fs_bytes > 0) {
+ sbd.fssize = sm->sm_fs_bytes / sbd.sd_bsize;
printf("Saved file system size is %"PRIu64" blocks, %.2fGB\n",
- sbd.fssize, sm.sm_fs_bytes / ((float)(1 << 30)));
+ sbd.fssize, sm->sm_fs_bytes / ((float)(1 << 30)));
}
printf("Block size is %uB\n", sbd.sd_bsize);
printf("This is gfs%c metadata.\n", sbd.gfs1 ? '1': '2');
@@ -1406,6 +1405,8 @@ static int restore_init(const char *path, struct metafd *mfd, int printonly)
void restoremeta(const char *in_fn, const char *out_device, uint64_t printonly)
{
struct metafd mfd = {0};
+ struct savemeta sm = {0};
+ struct stat st;
int error;
termlines = 0;
@@ -1430,7 +1431,7 @@ void restoremeta(const char *in_fn, const char *out_device, uint64_t printonly)
optional block no */
printonly = check_keywords(out_device);
- error = restore_init(in_fn, &mfd, printonly);
+ error = restore_init(in_fn, &mfd, &sm, printonly);
if (error != 0)
exit(error);
@@ -1440,6 +1441,23 @@ void restoremeta(const char *in_fn, const char *out_device, uint64_t printonly)
}
error = restore_data(sbd.device_fd, &mfd, printonly);
+
+ /* When there is a metadata header available, truncate to filesystem
+ size if our device_fd is a regular file */
+ if (!printonly) {
+ if (fstat(sbd.device_fd, &st) == -1) {
+ fprintf(stderr, "Failed to stat %s: %s\n", out_device, strerror(errno));
+ error = errno;
+ }
+
+ if (sm.sm_fs_bytes > 0 && S_ISREG(st.st_mode)) {
+ if (ftruncate(sbd.device_fd, sm.sm_fs_bytes) != 0) {
+ fprintf(stderr, "Failed to truncate: %s, %s\n", out_device, strerror(errno));
+ error = errno;
+ }
+ }
+ }
+
printf("File %s %s %s.\n", in_fn,
(printonly ? "print" : "restore"),
(error ? "error" : "successful"));
diff --git a/tests/edit.at b/tests/edit.at
index d6795218..29835df0 100644
--- a/tests/edit.at
+++ b/tests/edit.at
@@ -61,3 +61,13 @@ AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT], 0, [ignore], [ignore])
AT_CHECK([gfs2_edit savemeta -z0 $GFS_TGT /dev/null], 0, [ignore], [ignore])
AT_CHECK([gfs2_edit savemeta $GFS_TGT /dev/null], 0, [ignore], [ignore])
AT_CLEANUP
+
+AT_SETUP([Truncate on restoremeta])
+AT_KEYWORDS(gfs2_edit edit)
+GFS_TGT_REGEN
+AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([gfs2_edit savemeta $GFS_TGT test.meta], 0, [ignore], [ignore])
+AT_CHECK([truncate -s 10K test.file], 0, [ignore], [ignore])
+AT_CHECK([gfs2_edit restoremeta test.meta test.file], 0, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -n test.file], 0, [ignore], [ignore])
+AT_CLEANUP

View File

@ -1,130 +0,0 @@
commit 47261faa39aca05d6feb486fdeec26f8ffc3ef15
Author: Andrew Price <anprice@redhat.com>
Date: Fri Aug 17 12:49:24 2018 +0100
fsck.gfs2: Don't check fs formats we don't recognise
Currently fsck.gfs2 will ignore sb_fs_format but in order to support
future formats we need to make sure it doesn't try to check filesystems
with formats we don't recognise yet. Better late than never.
Tests included.
rhbz#1616389
rhbz#1622050
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index d3f76352..877448c3 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -4,6 +4,8 @@
#include "libgfs2.h"
#include "osi_tree.h"
+#define FSCK_MAX_FORMAT (1801)
+
#define FSCK_HASH_SHIFT (13)
#define FSCK_HASH_SIZE (1 << FSCK_HASH_SHIFT)
#define FSCK_HASH_MASK (FSCK_HASH_SIZE - 1)
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index ebe62b9f..d1c620af 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -1334,12 +1334,12 @@ static int fill_super_block(struct gfs2_sbd *sdp)
if (sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize){
log_crit( _("GFS superblock is larger than the blocksize!\n"));
log_debug("sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize\n");
- return -1;
+ return FSCK_ERROR;
}
if (compute_constants(sdp)) {
log_crit("%s\n", _("Failed to compute file system constants"));
- exit(FSCK_ERROR);
+ return FSCK_ERROR;
}
ret = read_sb(sdp);
if (ret < 0) {
@@ -1348,10 +1348,15 @@ static int fill_super_block(struct gfs2_sbd *sdp)
/* Now that we've tried to repair it, re-read it. */
ret = read_sb(sdp);
if (ret < 0)
- return -1;
+ return FSCK_ERROR;
}
if (sdp->gfs1)
sbd1 = (struct gfs_sb *)&sdp->sd_sb;
+ else if (sdp->sd_sb.sb_fs_format > FSCK_MAX_FORMAT) {
+ log_crit(_("Unsupported gfs2 format found: %"PRIu32"\n"), sdp->sd_sb.sb_fs_format);
+ log_crit(_("A newer fsck.gfs2 is required to check this file system.\n"));
+ return FSCK_USAGE;
+ }
return 0;
}
@@ -1556,6 +1561,7 @@ int initialize(struct gfs2_sbd *sdp, int force_check, int preen,
int *all_clean)
{
int clean_journals = 0, open_flag;
+ int err;
*all_clean = 0;
@@ -1601,8 +1607,9 @@ int initialize(struct gfs2_sbd *sdp, int force_check, int preen,
}
/* read in sb from disk */
- if (fill_super_block(sdp))
- return FSCK_ERROR;
+ err = fill_super_block(sdp);
+ if (err != FSCK_OK)
+ return err;
/* Change lock protocol to be fsck_* instead of lock_* */
if (!opts.no && preen_is_safe(sdp, preen, force_check)) {
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
index 6e7d8c23..75925643 100644
--- a/gfs2/libgfs2/super.c
+++ b/gfs2/libgfs2/super.c
@@ -29,11 +29,18 @@ int check_sb(struct gfs2_sb *sb)
errno = EIO;
return -1;
}
+ /* Check for gfs1 */
if (sb->sb_fs_format == GFS_FORMAT_FS &&
sb->sb_header.mh_format == GFS_FORMAT_SB &&
sb->sb_multihost_format == GFS_FORMAT_MULTI) {
return 1;
}
+ /* It's gfs2. Check format number is in a sensible range. */
+ if (sb->sb_fs_format < GFS2_FORMAT_FS ||
+ sb->sb_fs_format > 1899) {
+ errno = EINVAL;
+ return -1;
+ }
return 2;
}
diff --git a/tests/fsck.at b/tests/fsck.at
index 39a04d04..97a00a90 100644
--- a/tests/fsck.at
+++ b/tests/fsck.at
@@ -54,3 +54,16 @@ AT_CHECK([gfs2_edit -p journal0 field di_header.mh_magic 0 $GFS_TGT], 0, [ignore
AT_CHECK([fsck.gfs2 -y $GFS_TGT], 1, [ignore], [ignore])
AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
AT_CLEANUP
+
+AT_SETUP([gfs2 format versions])
+AT_KEYWORDS(fsck.gfs2 fsck)
+GFS_TGT_REGEN
+AT_CHECK([mkfs.gfs2 -O -p lock_nolock ${GFS_TGT}], 0, [ignore], [ignore])
+AT_CHECK([echo "set sb { sb_fs_format: 1802 }" | gfs2l ${GFS_TGT}], 0, [ignore], [ignore])
+# Unsupported format, FSCK_USAGE == 16
+AT_CHECK([fsck.gfs2 -y $GFS_TGT], 16, [ignore], [ignore])
+# Format out of range
+AT_CHECK([echo "set sb { sb_fs_format: 4242 }" | gfs2l ${GFS_TGT}], 0, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -y $GFS_TGT], 1, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
+AT_CLEANUP

View File

@ -1,47 +0,0 @@
commit 57553571df2f33ec45a81fa5599873ddfc890c92
Author: Andrew Price <anprice@redhat.com>
Date: Thu Sep 6 14:28:19 2018 +0100
libgfs2: Fix pointer cast byte order issue
lgfs2_field_assign() currently uses pointer casting to achieve generic
integer assignment based on the width of the field, but this is broken
as a uin32_t field can be assigned the value from the high bytes of the
uint64_t value, for instance. To fix this, store the value into a
uint64_t before casting to the narrower types.
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index a8289466..e0ea4912 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -940,6 +940,7 @@ int lgfs2_field_str(char *str, const size_t size, const char *blk, const struct
int lgfs2_field_assign(char *blk, const struct lgfs2_metafield *field, const void *val)
{
char *fieldp = blk + field->offset;
+ uint64_t num = *(uint64_t *)val;
if (field->flags & LGFS2_MFF_UUID) {
memcpy(fieldp, val, 16);
@@ -959,16 +960,16 @@ int lgfs2_field_assign(char *blk, const struct lgfs2_metafield *field, const voi
switch(field->length) {
case sizeof(uint8_t):
- *fieldp = *(uint8_t *)val;
+ *fieldp = (uint8_t)num;
return 0;
case sizeof(uint16_t):
- *(uint16_t *)fieldp = cpu_to_be16(*(uint16_t *)val);
+ *(uint16_t *)fieldp = cpu_to_be16((uint16_t)num);
return 0;
case sizeof(uint32_t):
- *(uint32_t *)fieldp = cpu_to_be32(*(uint32_t *)val);
+ *(uint32_t *)fieldp = cpu_to_be32((uint32_t)num);
return 0;
case sizeof(uint64_t):
- *(uint64_t *)fieldp = cpu_to_be64(*(uint64_t *)val);
+ *(uint64_t *)fieldp = cpu_to_be64((uint64_t)num);
return 0;
default:
/* Will never happen */

View File

@ -1,39 +0,0 @@
commit 7095c5f1ab7ab2d9e02c203c9966b65c09249e1f
Author: Bob Peterson <rpeterso@redhat.com>
Date: Fri Dec 14 09:16:19 2018 -0500
gfs2-utils: Wrong hash value used to clean journals
When fsck.gfs2 sees a dirty journal, (one that does not have a
log header with the UNMOUNT flag set at the wrap-point), it replays
the journal and writes a log header out to "clean" the journal.
Unfortunately, before this patch, it was using the wrong hash value.
So every time fsck.gfs2 was run, it would not recognize its own
log header because of the wrong hash, and therefore it would always
see the journal as dirty with every run (until the file system is
mounted and unmounted, which would write a new correct log header).
Therefore, multiple runs of fsck.gfs2 would always result in a
replay of the journal, which remains "dirty."
This patch changes function clean_journal so that it uses the
correct hash function. Therefore, the journal will be truly clean
and consecutive runs (or mounts) will find the journal clean.
Resolves: rhbz#1659490
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
index 6b14bf94..06f81116 100644
--- a/gfs2/libgfs2/recovery.c
+++ b/gfs2/libgfs2/recovery.c
@@ -241,7 +241,7 @@ int clean_journal(struct gfs2_inode *ip, struct gfs2_log_header *head)
lh->lh_sequence = cpu_to_be64(head->lh_sequence + 1);
lh->lh_flags = cpu_to_be32(GFS2_LOG_HEAD_UNMOUNT);
lh->lh_blkno = cpu_to_be32(lblock);
- hash = gfs2_disk_hash((const char *)lh, sizeof(struct gfs2_log_header));
+ hash = lgfs2_log_header_hash(bh->b_data);
lh->lh_hash = cpu_to_be32(hash);
bmodified(bh);
brelse(bh);

View File

@ -1,86 +0,0 @@
commit f81fd07bdf8cf9f87c603754e3e5b89ed5445bf8
Author: Andrew Price <anprice@redhat.com>
Date: Thu Oct 17 13:12:31 2019 +0100
fsck.gfs2(8): Manpage updates
- Improve style consistency with the other manpages
- Remove an unnecessary paragraph that gives a misleading impression of
gfs2's device atomicity requirements (rhbz#1693000)
- Add "See Also" section
- "fsck.gfs" -> "fsck.gfs2"
- Various other language tweaks
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/man/fsck.gfs2.8 b/gfs2/man/fsck.gfs2.8
index b2b326fb..9e9f9250 100644
--- a/gfs2/man/fsck.gfs2.8
+++ b/gfs2/man/fsck.gfs2.8
@@ -1,11 +1,11 @@
.TH fsck.gfs2 8
.SH NAME
-fsck.gfs2 - Offline GFS and GFS2 file system checker
+fsck.gfs2 - offline GFS and GFS2 file system checker
.SH SYNOPSIS
.B fsck.gfs2
-[\fIOPTION\fR]... \fIDEVICE\fR
+[\fIoptions\fR] \fIdevice\fR
.SH WARNING
All computers \fImust\fP have the filesystem unmounted before running
@@ -13,30 +13,22 @@ fsck.gfs2. Failure to unmount from all nodes in a cluster will likely result
in filesystem corruption.
.SH DESCRIPTION
-fsck.gfs2 will check that the GFS or GFS2 file system on a device is structurally valid.
-It should not be run on a mounted file system. If file system corruption is
-detected, it will attempt to repair the file system. There is a limit to what
-fsck.gfs2 can do. If important file system structures are destroyed, such that
-the checker cannot determine what the repairs should be, reparations could
-fail.
+fsck.gfs2 will check that the GFS or GFS2 file system on a device is
+structurally valid. It should not be run on a mounted file system. If file
+system corruption is detected, it will attempt to repair the file system.
+There is a limit to what fsck.gfs2 can do. If important file system structures
+are destroyed, such that the checker cannot determine what the repairs should
+be, reparations could fail.
-GFS2 is a journaled file system, and as such should be able to repair damage to
-the file system on its own. However, faulty hardware has the ability to write
-incomplete blocks to a file system thereby causing corruption that GFS2 cannot
-fix. The first step to ensuring a healthy file system is the selection of
-reliable hardware (i.e. storage systems that will write complete blocks - even
-in the event of power failure).
-
-Note: Most file system checkers will not check the file system if it is
-"clean" (i.e. unmounted since the last use). The fsck.gfs program behaves
-differently because the storage may be shared among several nodes in a
-cluster, and therefore problems may have been introduced on a different
-computer. Therefore, fsck.gfs2 will always check the file system unless
-the -p (preen) option is used, in which case it follows special rules
+Other file system checkers will not check the file system if it is "clean"
+(i.e. unmounted since the last use). With gfs2, storage may be shared among
+several nodes in a cluster, and therefore problems may have been introduced on
+a different computer. Therefore, fsck.gfs2 will always check the file system
+unless the -p (preen) option is used, in which case it follows special rules
(see below).
-fsck.gfs2 will log to the system log on start and exit to aid debugging and
-administration.
+fsck.gfs2 will log a message to the system log on start and exit to aid
+debugging and administration.
.SH OPTIONS
.TP
\fB-a\fP
@@ -86,3 +78,8 @@ Yes to all questions. By specifying this option, fsck.gfs2 will not prompt befor
changes.
This option may not be used with the \fB-n\fP or \fB-p\fP/\fB-a\fP options.
+
+.SH SEE ALSO
+.BR gfs2 (5),
+.BR gfs2_jadd (8),
+.BR gfs2_grow (8)

View File

@ -1,47 +0,0 @@
commit 12a82c8661b003736a0cb14fe042605f2412c329
Author: Andrew Price <anprice@redhat.com>
Date: Thu Apr 25 11:21:22 2019 +0100
mkfs.gfs2: Improve alignment of first resource group
Currently the first rgrp is aligned to the whole stripe width and the
second rgrp is aligned to (stripe width + 1 stripe unit) and so on, to
spread them across an array. However, that means that there could be a
large amount of space wasted between the superblock and the first
resource group, and can result in the iovec used to zero that space
exceeding IOV_MAX and failing mkfs.gfs2 (since 6cefaf33d5) if the array
has a sufficiently large number of LUNs. Instead, align the first
resource group to a stripe unit so that the gap is minimised. Resource
groups are still spread across the array as the alignment of subsequent
ones are handled separately.
Resolves: rhbz#1698858
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 3cdaccae..20ce5807 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -332,7 +332,7 @@ static uint64_t align_block(const uint64_t base, const uint64_t align)
*/
uint64_t lgfs2_rgrp_align_addr(const lgfs2_rgrps_t rgs, uint64_t addr)
{
- return align_block(addr, rgs->align);
+ return align_block(addr, rgs->align_off);
}
/**
diff --git a/tests/mkfs.at b/tests/mkfs.at
index 2739561f..57785a0d 100644
--- a/tests/mkfs.at
+++ b/tests/mkfs.at
@@ -122,6 +122,8 @@ AT_KEYWORDS(mkfs.gfs2 mkfs)
AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:512:65536:393216:512 $GFS_TGT], 0, [ignore], [ignore])
# Check rgrp alignment to minimum_io_size: 65536 / 4096 == 16
AT_CHECK([gfs2_edit -p rindex $GFS_TGT | grep ri_addr | awk '{print $2, $2 % 16; if ($2 % 16 != 0) { exit 1 }}'], 0, [ignore], [ignore])
+# rhbz#1698858
+AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:512:131072:6291456:512 $GFS_TGT], 0, [ignore], [ignore])
AT_CLEANUP
AT_SETUP([Values of rg_skip])

View File

@ -1,291 +0,0 @@
commit 75934649b85259d1559eabca40be820095643239
Author: Andrew Price <anprice@redhat.com>
Date: Tue Feb 12 09:58:11 2019 +0000
gfs2.5: General updates and layout improvements
- Update the manpage to mention lvmlockd and don't mention gfs2_quota
or gfs_controld (both obsolete).
- Simplify the setup instructions and refer to distribution-specific
docs and support requirements.
- Rearrange the "See also" section for relevance and incorporate the
references from the setup section.
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/man/gfs2.5 b/gfs2/man/gfs2.5
index 56d1a008..436abc09 100644
--- a/gfs2/man/gfs2.5
+++ b/gfs2/man/gfs2.5
@@ -21,6 +21,20 @@ mounts which are equivalent to mounting a read-only block device and as
such can neither recover a journal or write to the filesystem, so do not
require a journal assigned to them.
+The GFS2 documentation has been split into a number of sections:
+
+\fBmkfs.gfs2\fP(8) Create a GFS2 filesystem
+.br
+\fBfsck.gfs2\fP(8) The GFS2 filesystem checker
+.br
+\fBgfs2_grow\fP(8) Growing a GFS2 filesystem
+.br
+\fBgfs2_jadd\fP(8) Adding a journal to a GFS2 filesystem
+.br
+\fBtunegfs2\fP(8) Tool to manipulate GFS2 superblocks
+.br
+\fBgfs2_edit\fP(8) A GFS2 debug tool (use with caution)
+
.SH MOUNT OPTIONS
.TP
@@ -200,220 +214,55 @@ versa. Finally, when first enabling this option on a filesystem that had been
previously mounted without it, you must make sure that there are no outstanding
cookies being cached by other software, such as NFS.
-.SH BUGS
-
-GFS2 doesn't support \fBerrors=\fP\fIremount-ro\fR or \fBdata=\fP\fIjournal\fR.
-It is not possible to switch support for user and group quotas on and
-off independently of each other. Some of the error messages are rather
-cryptic, if you encounter one of these messages check firstly that gfs_controld
-is running and secondly that you have enough journals on the filesystem
-for the number of nodes in use.
-
-.SH SEE ALSO
-
-\fBmount\fP(8) for general mount options,
-\fBchmod\fP(1) and \fBchmod\fP(2) for access permission flags,
-\fBacl\fP(5) for access control lists,
-\fBlvm\fP(8) for volume management,
-\fBccs\fP(7) for cluster management,
-\fBumount\fP(8),
-\fBinitrd\fP(4).
-
-The GFS2 documentation has been split into a number of sections:
-
-\fBgfs2_edit\fP(8) A GFS2 debug tool (use with caution)
-\fBfsck.gfs2\fP(8) The GFS2 file system checker
-\fBgfs2_grow\fP(8) Growing a GFS2 file system
-\fBgfs2_jadd\fP(8) Adding a journal to a GFS2 file system
-\fBmkfs.gfs2\fP(8) Make a GFS2 file system
-\fBgfs2_quota\fP(8) Manipulate GFS2 disk quotas
-\fBgfs2_tool\fP(8) Tool to manipulate a GFS2 file system (obsolete)
-\fBtunegfs2\fP(8) Tool to manipulate GFS2 superblocks
-
.SH SETUP
-GFS2 clustering is driven by the dlm, which depends on dlm_controld to
-provide clustering from userspace. dlm_controld clustering is built on
-corosync cluster/group membership and messaging.
-
-Follow these steps to manually configure and run gfs2/dlm/corosync.
-
-.B 1. create /etc/corosync/corosync.conf and copy to all nodes
-
-In this sample, replace cluster_name and IP addresses, and add nodes as
-needed. If using only two nodes, uncomment the two_node line.
-See corosync.conf(5) for more information.
-
-.nf
-totem {
- version: 2
- secauth: off
- cluster_name: abc
-}
-
-nodelist {
- node {
- ring0_addr: 10.10.10.1
- nodeid: 1
- }
- node {
- ring0_addr: 10.10.10.2
- nodeid: 2
- }
- node {
- ring0_addr: 10.10.10.3
- nodeid: 3
- }
-}
-
-quorum {
- provider: corosync_votequorum
-# two_node: 1
-}
-
-logging {
- to_syslog: yes
-}
-.fi
-
-.PP
-
-.B 2. start corosync on all nodes
-
-.nf
-systemctl start corosync
-.fi
-
-Run corosync-quorumtool to verify that all nodes are listed.
-
-.PP
-
-.B 3. create /etc/dlm/dlm.conf and copy to all nodes
-
-.B *
-To use no fencing, use this line:
+GFS2 clustering is driven by the dlm, which depends on dlm_controld to provide
+clustering from userspace. dlm_controld clustering is built on corosync
+cluster/group membership and messaging. GFS2 also requires clustered lvm which
+is provided by lvmlockd or, previously, clvmd. Refer to the documentation for
+each of these components and ensure that they are configured before setting up
+a GFS2 filesystem. Also refer to your distribution's documentation for any
+specific support requirements.
-.nf
-enable_fencing=0
-.fi
+Ensure that gfs2-utils is installed on all nodes which mount the filesystem as
+it provides scripts required for correct withdraw event response.
-.B *
-To use no fencing, but exercise fencing functions, use this line:
-
-.nf
-fence_all /bin/true
-.fi
-
-The "true" binary will be executed for all nodes and will succeed (exit 0)
-immediately.
-
-.B *
-To use manual fencing, use this line:
-
-.nf
-fence_all /bin/false
-.fi
-
-The "false" binary will be executed for all nodes and will fail (exit 1)
-immediately.
-
-When a node fails, manually run: dlm_tool fence_ack <nodeid>
-
-.B *
-To use stonith/pacemaker for fencing, use this line:
-
-.nf
-fence_all /usr/sbin/dlm_stonith
-.fi
-
-The "dlm_stonith" binary will be executed for all nodes. If
-stonith/pacemaker systems are not available, dlm_stonith will fail and
-this config becomes the equivalent of the previous /bin/false config.
-
-.B *
-To use an APC power switch, use these lines:
-
-.nf
-device apc /usr/sbin/fence_apc ipaddr=1.1.1.1 login=admin password=pw
-connect apc node=1 port=1
-connect apc node=2 port=2
-connect apc node=3 port=3
-.fi
-
-Other network switch based agents are configured similarly.
-
-.B *
-To use sanlock/watchdog fencing, use these lines:
-
-.nf
-device wd /usr/sbin/fence_sanlock path=/dev/fence/leases
-connect wd node=1 host_id=1
-connect wd node=2 host_id=2
-unfence wd
-.fi
-
-See fence_sanlock(8) for more information.
-
-.B *
-For other fencing configurations see dlm.conf(5) man page.
-
-.PP
-
-.B 4. start dlm_controld on all nodes
-
-.nf
-systemctl start dlm
-.fi
-
-Run "dlm_tool status" to verify that all nodes are listed.
-
-.PP
-
-.B 5. if using clvm, start clvmd on all nodes
-
-systemctl clvmd start
-
-.PP
-
-.B 6. make new gfs2 file systems
+.B 1. Create the gfs2 filesystem
mkfs.gfs2 -p lock_dlm -t cluster_name:fs_name -j num /path/to/storage
-The cluster_name must match the name used in step 1 above.
-The fs_name must be a unique name in the cluster.
-The -j option is the number of journals to create, there must
-be one for each node that will mount the fs.
+The cluster_name must match the name configured in corosync (and thus dlm).
+The fs_name must be a unique name for the filesystem in the cluster.
+The -j option is the number of journals to create; there must
+be one for each node that will mount the filesystem.
.PP
+.B 2. Mount the gfs2 filesystem
-.B 7. mount gfs2 file systems
+If you are using a clustered resource manager, see its documentation for
+enabling a gfs2 filesystem resource. Otherwise, run:
mount /path/to/storage /mountpoint
Run "dlm_tool ls" to verify the nodes that have each fs mounted.
.PP
+.B 3. Shut down
-.B 8. shut down
+If you are using a clustered resource manager, see its documentation for
+disabling a gfs2 filesystem resource. Otherwise, run:
-.nf
umount -a -t gfs2
-systemctl clvmd stop
-systemctl dlm stop
-systemctl corosync stop
-.fi
.PP
+.SH SEE ALSO
-.B More setup information:
-.br
-.BR dlm_controld (8),
-.br
-.BR dlm_tool (8),
-.br
-.BR dlm.conf (5),
-.br
-.BR corosync (8),
-.br
-.BR corosync.conf (5)
-.br
+\fBmount\fP(8) and \fBumount\fP(8) for general mount information,
+\fBchmod\fP(1) and \fBchmod\fP(2) for access permission flags,
+\fBacl\fP(5) for access control lists,
+\fBlvm\fP(8) for volume management,
+\fBdlm_controld\fP(8),
+\fBdlm_tool\fP(8),
+\fBdlm.conf\fP(5),
+\fBcorosync\fP(8),
+\fBcorosync.conf\fP(5),

View File

@ -1,55 +0,0 @@
commit ea571e0e9f8f72b30732e1c2a43a09247c3eedd9
Author: Andrew Price <anprice@redhat.com>
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 <anprice@redhat.com>
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])

View File

@ -1,31 +0,0 @@
commit 6a5d984b2d5deb989faae2ce567e886b400f257d
Author: Andrew Price <anprice@redhat.com>
Date: Tue Apr 7 15:25:06 2020 +0100
gfs2.5: Update some mentions of gfs2_tool
Resolves: rhbz#1818983
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/man/gfs2.5 b/gfs2/man/gfs2.5
index 436abc09..8f67ce23 100644
--- a/gfs2/man/gfs2.5
+++ b/gfs2/man/gfs2.5
@@ -48,7 +48,7 @@ currently these are \fIlock_nolock\fR and \fIlock_dlm\fR.
The default lock protocol name is written to disk initially when creating the
filesystem with \fBmkfs.gfs2\fP(8), -p option. It can be changed on-disk by
-using the \fBgfs2_tool\fP(8) utility's \fBsb proto\fP command.
+using the \fBtunegfs2\fP(8) command.
The \fBlockproto\fP mount option should be used only under special
circumstances in which you want to temporarily use a different lock protocol
@@ -70,7 +70,7 @@ The format of \fILockTableName\fR is lock-module-specific. For
The default cluster/filesystem name is written to disk initially when creating
the filesystem with \fBmkfs.gfs2\fP(8), -t option. It can be changed on-disk
-by using the \fBgfs2_tool\fP(8) utility's \fBsb table\fP command.
+by using the \fBtunegfs2\fP(8) command.
The \fBlocktable\fP mount option should be used only under special
circumstances in which you want to mount the filesystem in a different cluster,

View File

@ -1,113 +0,0 @@
commit d033351753e1c45e6be74342d05de0a2501d5211
Author: Abhi Das <adas@redhat.com>
Date: Mon May 11 09:22:31 2020 -0500
gfs2_jadd: Handle out-of-space issues
If gfs2_jadd runs out of disk space while adding journals, it does
not exit gracefully. It partially does its job and bails out when
it hits -ENOSPC. This leaves the metafs mounted and most likely a
corrupted filesystem that even fsck.gfs2 can't fix.
This patch adds a pre-check that ensures that the journals requested
will fit in the available space before proceeding. Note that this is
not foolproof because gfs2_jadd operates on a mounted filesystem.
While it is required that the filesystem be idle (and mounted on only
one node) while gfs2_jadd is being run, there is nothing stopping a
user from having some I/O process competing with gfs2_jadd for disk
blocks and consequently crashing it.
Resolves: rhbz#1833141
Signed-off-by: Abhi Das <adas@redhat.com>
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index efe91e30..c5424803 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -396,6 +396,8 @@ static void gather_info(struct gfs2_sbd *sdp, struct jadd_opts *opts)
exit(EXIT_FAILURE);
}
sdp->bsize = statbuf.f_bsize;
+ sdp->blks_total = statbuf.f_blocks;
+ sdp->blks_alloced = sdp->blks_total - statbuf.f_bfree;
}
static void find_current_journals(struct jadd_opts *opts)
@@ -527,13 +529,43 @@ static void add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
}
}
+static int check_fit(struct gfs2_sbd *sdp, struct jadd_opts *opts)
+{
+ /* Compute how much space we'll need for the new journals
+ * Number of blocks needed per added journal:
+ * 1 block for the ir inode
+ * 1 block for the sc inode
+ * for sizes of the qc and journal inodes, use lgfs2_space_for_data()
+ * to calculate.
+ */
+ uint64_t blks_per_j, total_blks;
+
+ blks_per_j = 1 + 1 +
+ lgfs2_space_for_data(sdp, sdp->bsize, sdp->qcsize << 20) +
+ lgfs2_space_for_data(sdp, sdp->bsize, sdp->jsize << 20);
+ total_blks = opts->journals * blks_per_j;
+
+ if (total_blks > (sdp->blks_total - sdp->blks_alloced)) {
+ printf( _("\nInsufficient space on the device to add %u %uMB "
+ "journals (%uMB QC size)\n\n"),
+ opts->journals, sdp->jsize, sdp->qcsize);
+ printf( _("Required space : %*lu blks (%lu blks per "
+ "journal)\n"), 10, total_blks, blks_per_j);
+ printf( _("Available space : %*lu blks\n\n"), 10,
+ sdp->blks_total - sdp->blks_alloced);
+ errno = ENOSPC;
+ return 1;
+ }
+ return 0;
+}
+
int main(int argc, char *argv[])
{
struct jadd_opts opts = {0};
struct gfs2_sbd sbd, *sdp = &sbd;
struct metafs mfs = {0};
struct mntent *mnt;
- unsigned int total;
+ unsigned int total, ret = 0;
setlocale(LC_ALL, "");
textdomain("gfs2-utils");
@@ -574,6 +606,12 @@ int main(int argc, char *argv[])
}
find_current_journals(&opts);
+ ret = check_fit(sdp, &opts);
+ if (ret) {
+ perror(_("Failed to add journals"));
+ goto out;
+ }
+
total = opts.orig_journals + opts.journals;
for (opts.journals = opts.orig_journals;
opts.journals < total;
@@ -588,13 +626,16 @@ int main(int argc, char *argv[])
add_j(sdp, &opts);
}
+out:
free(opts.new_inode);
free(opts.per_node);
free(opts.jindex);
close(sdp->path_fd);
cleanup_metafs(&mfs);
sync();
- print_results(&opts);
- return 0;
+ if (!ret)
+ print_results(&opts);
+
+ return ret;
}

View File

@ -1,608 +0,0 @@
commit 206b040657b5125c2f2efe35dddcb7463fb49788
Author: Abhi Das <adas@redhat.com>
Date: Mon May 11 14:41:06 2020 -0500
gfs2_jadd: error handling overhaul
Handle error conditions better and fail gracefully.
Resolves: rhbz#1833141
Signed-off-by: Abhi Das <adas@redhat.com>
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index c5424803..ea89c96b 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -42,15 +42,13 @@ struct jadd_opts {
#define JA_FL_SET 0
#define JA_FL_CLEAR 1
-static void set_flags(int fd, int op, uint32_t flags)
+static int set_flags(int fd, int op, uint32_t flags)
{
- int err;
uint32_t val;
- err = ioctl(fd, FS_IOC_GETFLAGS, &val);
- if (err) {
+ if (ioctl(fd, FS_IOC_GETFLAGS, &val)) {
perror("GETFLAGS");
- exit(EXIT_FAILURE);
+ return -1;
}
if (op == JA_FL_SET)
@@ -58,11 +56,11 @@ static void set_flags(int fd, int op, uint32_t flags)
else if (op == JA_FL_CLEAR)
val &= ~flags;
- err = ioctl(fd, FS_IOC_SETFLAGS, &val);
- if (err) {
+ if (ioctl(fd, FS_IOC_SETFLAGS, &val)) {
perror("SETFLAGS");
- exit(EXIT_FAILURE);
+ return -1;
}
+ return 0;
}
static int rename2system(struct jadd_opts *opts, const char *new_dir, const char *new_name)
@@ -243,188 +241,214 @@ static void print_results(struct jadd_opts *opts)
static int create_new_inode(struct jadd_opts *opts, uint64_t *addr)
{
char *name = opts->new_inode;
- int fd;
- int error;
+ int fd, error = 0;
for (;;) {
fd = open(name, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, 0600);
if (fd >= 0)
break;
if (errno == EEXIST) {
- error = unlink(name);
- if (error){
+ if (unlink(name)) {
perror("unlink");
- exit(EXIT_FAILURE);
+ return -1;
}
- } else{
- perror("create");
- exit(EXIT_FAILURE);
+ continue;
}
+ perror("create");
+ return -1;
}
+
if (addr != NULL) {
struct stat st;
- fstat(fd, &st);
+ if ((error = fstat(fd, &st))) {
+ perror("fstat");
+ return close(fd);
+ }
*addr = st.st_ino;
}
return fd;
}
-static void add_ir(struct jadd_opts *opts)
+static int add_ir(struct jadd_opts *opts)
{
- int fd;
+ int fd, error = 0;
char new_name[256];
- int error;
+ struct gfs2_inum_range ir;
- fd = create_new_inode(opts, NULL);
+ if ((fd = create_new_inode(opts, NULL)) < 0)
+ return fd;
- {
- struct gfs2_inum_range ir;
+ if ((error = set_flags(fd, JA_FL_SET, FS_JOURNAL_DATA_FL)))
+ goto close_fd;
- set_flags(fd, JA_FL_SET, FS_JOURNAL_DATA_FL);
- memset(&ir, 0, sizeof(struct gfs2_inum_range));
- if (write(fd, (void*)&ir, sizeof(struct gfs2_inum_range)) !=
- sizeof(struct gfs2_inum_range)) {
- perror("add_ir");
- exit(EXIT_FAILURE);
- }
+ memset(&ir, 0, sizeof(struct gfs2_inum_range));
+ if (write(fd, (void*)&ir, sizeof(struct gfs2_inum_range)) !=
+ sizeof(struct gfs2_inum_range)) {
+ perror("add_ir write");
+ error = -1;
+ goto close_fd;
+ }
+
+ if ((error = fsync(fd))) {
+ perror("add_ir fsync");
+ goto close_fd;
}
- close(fd);
sprintf(new_name, "inum_range%u", opts->journals);
error = rename2system(opts, opts->per_node, new_name);
- if (error < 0 && errno != EEXIST){
+ if (error < 0 && errno != EEXIST) {
perror("add_ir rename2system");
- exit(EXIT_FAILURE);
+ goto close_fd;
}
+close_fd:
+ return close(fd) || error;
}
-static void add_sc(struct jadd_opts *opts)
+static int add_sc(struct jadd_opts *opts)
{
- int fd;
+ int fd, error = 0;
char new_name[256];
- int error;
+ struct gfs2_statfs_change sc;
- fd = create_new_inode(opts, NULL);
+ if ((fd = create_new_inode(opts, NULL)) < 0)
+ return fd;
- {
- struct gfs2_statfs_change sc;
- set_flags(fd, JA_FL_SET, FS_JOURNAL_DATA_FL);
+ if ((error = set_flags(fd, JA_FL_SET, FS_JOURNAL_DATA_FL)))
+ goto close_fd;
- memset(&sc, 0, sizeof(struct gfs2_statfs_change));
- if (write(fd, (void*)&sc, sizeof(struct gfs2_statfs_change)) !=
- sizeof(struct gfs2_statfs_change)) {
- perror("add_sc");
- exit(EXIT_FAILURE);
- }
+ memset(&sc, 0, sizeof(struct gfs2_statfs_change));
+ if (write(fd, (void*)&sc, sizeof(struct gfs2_statfs_change)) !=
+ sizeof(struct gfs2_statfs_change)) {
+ perror("add_sc write");
+ error = -1;
+ goto close_fd;
}
- close(fd);
+ if ((error = fsync(fd))) {
+ perror("add_sc fsync");
+ goto close_fd;
+ }
sprintf(new_name, "statfs_change%u", opts->journals);
error = rename2system(opts, opts->per_node, new_name);
if (error < 0 && errno != EEXIST){
perror("add_sc rename2system");
- exit(EXIT_FAILURE);
+ goto close_fd;
}
+close_fd:
+ return close(fd) || error;
}
-static void add_qc(struct gfs2_sbd *sdp, struct jadd_opts *opts)
+static int add_qc(struct gfs2_sbd *sdp, struct jadd_opts *opts)
{
- int fd;
- char new_name[256];
- int error;
-
- fd = create_new_inode(opts, NULL);
-
- {
- char buf[sdp->bsize];
- unsigned int blocks =
- sdp->qcsize << (20 - sdp->sd_sb.sb_bsize_shift);
- unsigned int x;
- struct gfs2_meta_header mh;
-
- set_flags(fd, JA_FL_CLEAR, FS_JOURNAL_DATA_FL);
- memset(buf, 0, sdp->bsize);
-
- for (x=0; x<blocks; x++) {
- if (write(fd, buf, sdp->bsize) != sdp->bsize) {
- perror("add_qc");
- exit(EXIT_FAILURE);
- }
+ int fd, error = 0;
+ char new_name[256], buf[sdp->bsize];
+ unsigned int blocks =
+ sdp->qcsize << (20 - sdp->sd_sb.sb_bsize_shift);
+ unsigned int x;
+ struct gfs2_meta_header mh;
+
+ if ((fd = create_new_inode(opts, NULL)) < 0)
+ return fd;
+
+ if ((error = set_flags(fd, JA_FL_CLEAR, FS_JOURNAL_DATA_FL)))
+ goto close_fd;
+
+ memset(buf, 0, sdp->bsize);
+ for (x=0; x<blocks; x++) {
+ if (write(fd, buf, sdp->bsize) != sdp->bsize) {
+ perror("add_qc write");
+ error = -1;
+ goto close_fd;
}
+ }
- lseek(fd, 0, SEEK_SET);
-
- memset(&mh, 0, sizeof(struct gfs2_meta_header));
- mh.mh_magic = GFS2_MAGIC;
- mh.mh_type = GFS2_METATYPE_QC;
- mh.mh_format = GFS2_FORMAT_QC;
- gfs2_meta_header_out(&mh, buf);
+ if ((error = lseek(fd, 0, SEEK_SET)) < 0) {
+ perror("add_qc lseek");
+ goto close_fd;
+ }
- for (x=0; x<blocks; x++) {
- if (write(fd, buf, sdp->bsize) != sdp->bsize) {
- perror("add_qc");
- exit(EXIT_FAILURE);
- }
+ memset(&mh, 0, sizeof(struct gfs2_meta_header));
+ mh.mh_magic = GFS2_MAGIC;
+ mh.mh_type = GFS2_METATYPE_QC;
+ mh.mh_format = GFS2_FORMAT_QC;
+ gfs2_meta_header_out(&mh, buf);
+
+ for (x=0; x<blocks; x++) {
+ if (write(fd, buf, sdp->bsize) != sdp->bsize) {
+ perror("add_qc write");
+ error = 1;
+ goto close_fd;
}
-
- error = fsync(fd);
- if (error){
+ if ((error = fsync(fd))) {
perror("add_qc fsync");
- exit(EXIT_FAILURE);
+ goto close_fd;
}
}
- close(fd);
-
sprintf(new_name, "quota_change%u", opts->journals);
error = rename2system(opts, opts->per_node, new_name);
if (error < 0 && errno != EEXIST){
perror("add_qc rename2system");
- exit(EXIT_FAILURE);
+ goto close_fd;
}
+close_fd:
+ return close(fd) || error;
}
-static void gather_info(struct gfs2_sbd *sdp, struct jadd_opts *opts)
+static int gather_info(struct gfs2_sbd *sdp, struct jadd_opts *opts)
{
struct statfs statbuf;
+
if (statfs(opts->path, &statbuf) < 0) {
perror(opts->path);
- exit(EXIT_FAILURE);
+ return -1;
}
+
sdp->bsize = statbuf.f_bsize;
sdp->blks_total = statbuf.f_blocks;
sdp->blks_alloced = sdp->blks_total - statbuf.f_bfree;
+
+ return 0;
}
-static void find_current_journals(struct jadd_opts *opts)
+static int find_current_journals(struct jadd_opts *opts)
{
struct dirent *dp;
DIR *dirp;
unsigned existing_journals = 0;
+ int ret = 0;
dirp = opendir(opts->jindex);
if (!dirp) {
perror("jindex");
- exit(EXIT_FAILURE);
+ ret = -1;
+ goto out;
}
while (dirp) {
if ((dp = readdir(dirp)) != NULL) {
if (strncmp(dp->d_name, "journal", 7) == 0)
existing_journals++;
} else
- goto close;
+ goto close_fd;
}
-close:
- closedir(dirp);
+close_fd:
+ if ((ret = closedir(dirp)))
+ goto out;
+
if (existing_journals == 0) {
- die( _("No journals found. Did you run mkfs.gfs2 correctly?\n"));
+ errno = EINVAL;
+ perror("No journals found. Did you run mkfs.gfs2 correctly?\n");
+ ret = -1;
+ goto out;
}
opts->orig_journals = existing_journals;
+out:
+ return ret;
}
#ifdef GFS2_HAS_LH_V2
@@ -450,83 +474,88 @@ static uint64_t find_block_address(int fd, off_t offset, unsigned bsize)
}
#endif
-static void add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
+static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
{
- int fd;
- char new_name[256];
- int error;
- uint64_t addr;
-
- fd = create_new_inode(opts, &addr);
-
- {
- char buf[sdp->bsize];
- unsigned int blocks =
- sdp->jsize << (20 - sdp->sd_sb.sb_bsize_shift);
- unsigned int x;
- struct gfs2_log_header lh;
- uint64_t seq = RANDOM(blocks);
- off_t off = 0;
-
- set_flags(fd, JA_FL_CLEAR, FS_JOURNAL_DATA_FL);
- memset(buf, 0, sdp->bsize);
- for (x=0; x<blocks; x++) {
- if (write(fd, buf, sdp->bsize) != sdp->bsize) {
- perror("add_j");
- exit(EXIT_FAILURE);
- }
+ int fd, error = 0;
+ char new_name[256], buf[sdp->bsize];
+ unsigned int x, blocks =
+ sdp->jsize << (20 - sdp->sd_sb.sb_bsize_shift);
+ struct gfs2_log_header lh;
+ uint64_t seq = RANDOM(blocks), addr;
+ off_t off = 0;
+
+ if ((fd = create_new_inode(opts, &addr)) < 0)
+ return fd;
+
+ if ((error = set_flags(fd, JA_FL_CLEAR, FS_JOURNAL_DATA_FL)))
+ goto close_fd;
+
+ memset(buf, 0, sdp->bsize);
+ for (x=0; x<blocks; x++) {
+ if (write(fd, buf, sdp->bsize) != sdp->bsize) {
+ perror("add_j write");
+ error = -1;
+ goto close_fd;
}
+ }
- lseek(fd, 0, SEEK_SET);
+ if ((error = lseek(fd, 0, SEEK_SET)) < 0) {
+ perror("add_j lseek");
+ goto close_fd;
+ }
- memset(&lh, 0, sizeof(struct gfs2_log_header));
- lh.lh_header.mh_magic = GFS2_MAGIC;
- lh.lh_header.mh_type = GFS2_METATYPE_LH;
- lh.lh_header.mh_format = GFS2_FORMAT_LH;
- lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT;
+ memset(&lh, 0, sizeof(struct gfs2_log_header));
+ lh.lh_header.mh_magic = GFS2_MAGIC;
+ lh.lh_header.mh_type = GFS2_METATYPE_LH;
+ lh.lh_header.mh_format = GFS2_FORMAT_LH;
+ lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT;
#ifdef GFS2_HAS_LH_V2
- lh.lh_flags |= GFS2_LOG_HEAD_USERSPACE;
- lh.lh_jinode = addr;
+ lh.lh_flags |= GFS2_LOG_HEAD_USERSPACE;
+ lh.lh_jinode = addr;
#endif
- for (x=0; x<blocks; x++) {
- uint32_t hash;
-
- lh.lh_sequence = seq;
- lh.lh_blkno = x;
- gfs2_log_header_out(&lh, buf);
- hash = lgfs2_log_header_hash(buf);
- ((struct gfs2_log_header *)buf)->lh_hash = cpu_to_be32(hash);
+ for (x=0; x<blocks; x++) {
+ uint32_t hash;
#ifdef GFS2_HAS_LH_V2
- ((struct gfs2_log_header *)buf)->lh_addr = cpu_to_be64(
- find_block_address(fd, off, sdp->bsize));
- hash = lgfs2_log_header_crc(buf, sdp->bsize);
- ((struct gfs2_log_header *)buf)->lh_crc = cpu_to_be32(hash);
+ uint64_t blk_addr = 0;
#endif
- if (write(fd, buf, sdp->bsize) != sdp->bsize) {
- perror("add_j");
- exit(EXIT_FAILURE);
- }
-
- if (++seq == blocks)
- seq = 0;
- off += sdp->bsize;
+ lh.lh_sequence = seq;
+ lh.lh_blkno = x;
+ gfs2_log_header_out(&lh, buf);
+ hash = lgfs2_log_header_hash(buf);
+ ((struct gfs2_log_header *)buf)->lh_hash = cpu_to_be32(hash);
+#ifdef GFS2_HAS_LH_V2
+ if (!(blk_addr = find_block_address(fd, off, sdp->bsize))) {
+ error = -1;
+ goto close_fd;
+ }
+ ((struct gfs2_log_header *)buf)->lh_addr = cpu_to_be64(blk_addr);
+ hash = lgfs2_log_header_crc(buf, sdp->bsize);
+ ((struct gfs2_log_header *)buf)->lh_crc = cpu_to_be32(hash);
+#endif
+ if (write(fd, buf, sdp->bsize) != sdp->bsize) {
+ perror("add_j write");
+ error = -1;
+ goto close_fd;
}
- error = fsync(fd);
- if (error){
+ if (++seq == blocks)
+ seq = 0;
+ off += sdp->bsize;
+
+ if ((error = fsync(fd))) {
perror("add_j fsync");
- exit(EXIT_FAILURE);
+ goto close_fd;
}
}
- close(fd);
-
sprintf(new_name, "journal%u", opts->journals);
error = rename2system(opts, opts->jindex, new_name);
if (error < 0 && errno != EEXIST){
perror("add_j rename2system");
- exit(EXIT_FAILURE);
+ goto close_fd;
}
+close_fd:
+ return close(fd) || error;
}
static int check_fit(struct gfs2_sbd *sdp, struct jadd_opts *opts)
@@ -554,7 +583,7 @@ static int check_fit(struct gfs2_sbd *sdp, struct jadd_opts *opts)
printf( _("Available space : %*lu blks\n\n"), 10,
sdp->blks_total - sdp->blks_alloced);
errno = ENOSPC;
- return 1;
+ return -1;
}
return 0;
}
@@ -581,35 +610,42 @@ int main(int argc, char *argv[])
sbd.path_fd = lgfs2_open_mnt_dir(opts.path, O_RDONLY|O_CLOEXEC, &mnt);
if (sbd.path_fd < 0) {
- fprintf(stderr, _("Error looking up mount '%s': %s\n"), opts.path, strerror(errno));
- exit(EXIT_FAILURE);
+ fprintf(stderr, "Error looking up mount '%s': %s\n",
+ opts.path, strerror(errno));
+ ret = -1;
+ goto out;
}
if (mnt == NULL) {
- fprintf(stderr, _("%s: not a mounted gfs2 file system\n"), opts.path);
- exit(EXIT_FAILURE);
+ fprintf(stderr, "%s: not a mounted gfs2 file system\n", opts.path);
+ ret = -1;
+ goto close_sb;
}
- gather_info(sdp, &opts);
+
+ if ((ret = gather_info(sdp, &opts)))
+ goto close_sb;
+
mfs.context = copy_context_opt(mnt);
- if (mount_gfs2_meta(&mfs, mnt->mnt_dir, opts.debug)) {
+ if ((ret = mount_gfs2_meta(&mfs, mnt->mnt_dir, opts.debug))) {
perror("GFS2 metafs");
- exit(EXIT_FAILURE);
+ goto close_sb;
}
- if (build_paths(mfs.path, &opts)) {
+ if ((ret = build_paths(mfs.path, &opts))) {
perror(_("Failed to build paths"));
- exit(EXIT_FAILURE);
+ goto umount_meta;
}
- if (compute_constants(sdp)) {
+ if ((ret = compute_constants(sdp))) {
perror(_("Failed to compute file system constants"));
- exit(EXIT_FAILURE);
+ goto free_paths;
}
- find_current_journals(&opts);
- ret = check_fit(sdp, &opts);
- if (ret) {
+ if ((ret = find_current_journals(&opts)))
+ goto free_paths;
+
+ if ((ret = check_fit(sdp, &opts))) {
perror(_("Failed to add journals"));
- goto out;
+ goto free_paths;
}
total = opts.orig_journals + opts.journals;
@@ -617,23 +653,29 @@ int main(int argc, char *argv[])
opts.journals < total;
opts.journals++) {
if (metafs_interrupted) {
- cleanup_metafs(&mfs);
- exit(130);
+ errno = 130;
+ goto free_paths;
}
- add_ir(&opts);
- add_sc(&opts);
- add_qc(sdp, &opts);
- add_j(sdp, &opts);
+ if ((ret = add_ir(&opts)))
+ goto free_paths;
+ if ((ret = add_sc(&opts)))
+ goto free_paths;
+ if ((ret = add_qc(sdp, &opts)))
+ goto free_paths;
+ if ((ret = add_j(sdp, &opts)))
+ goto free_paths;
}
-out:
+free_paths:
free(opts.new_inode);
free(opts.per_node);
free(opts.jindex);
- close(sdp->path_fd);
- cleanup_metafs(&mfs);
+umount_meta:
sync();
-
+ cleanup_metafs(&mfs);
+close_sb:
+ close(sdp->path_fd);
+out:
if (!ret)
print_results(&opts);

View File

@ -1,41 +0,0 @@
commit b33f8871a821b7f0461dec89f0066a9cb6aa1c71
Author: Andrew Price <anprice@redhat.com>
Date: Wed May 27 12:31:58 2020 +0100
mkfs.gfs2: Don't use i/o limits hints <4K for block size
Some devices report an optimal_io_size less than 4K. Currently mkfs.gfs2
uses the non-zero value to choose the block size, which is almost
certainly a bad choice when it's less than 4K. Update choose_blocksize()
to avoid using device topology hints for the block size choice when
they're less than the default block size (4K). Test case included.
Resolves: rhbz#1839219
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 846b341f..412d4701 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -505,7 +505,7 @@ static unsigned choose_blocksize(struct mkfs_opts *opts)
}
if (!opts->got_bsize && got_topol) {
if (dev->optimal_io_size <= getpagesize() &&
- dev->optimal_io_size >= dev->minimum_io_size)
+ dev->optimal_io_size >= GFS2_DEFAULT_BSIZE)
bsize = dev->optimal_io_size;
else if (dev->physical_sector_size <= getpagesize() &&
dev->physical_sector_size >= GFS2_DEFAULT_BSIZE)
diff --git a/tests/mkfs.at b/tests/mkfs.at
index 57785a0d..4c8b2249 100644
--- a/tests/mkfs.at
+++ b/tests/mkfs.at
@@ -112,6 +112,8 @@ AT_CLEANUP
AT_SETUP([Device i/o limits handling])
AT_KEYWORDS(mkfs.gfs2 mkfs)
AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:0:0:0:0 $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:512:512:512:512 $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([gfs2_edit -p sb field sb_bsize $GFS_TGT | tr -d '\n' ], 0, [4096], [ignore])
AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=7168:512:0:33553920:512 $GFS_TGT], 0, [ignore], [ignore])
AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=7168:512:8192:33553920:512 $GFS_TGT], 0, [ignore], [Warning: device is not properly aligned. This may harm performance.
])

View File

@ -1,79 +0,0 @@
commit 13e09a3519cc7cbf9417acc86a6d046bdba71a9f
Author: Andrew Price <anprice@redhat.com>
Date: Thu Mar 18 17:30:53 2021 +0000
gfs2_jadd: Use fallocate to preallocate journals
Fall back to writes for ancient kernels and use larger writes in that
case to reduce the chance of fragmentation.
Resolves: rhbz#1942434
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index ea89c96b..b0cffbac 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -474,6 +474,43 @@ static uint64_t find_block_address(int fd, off_t offset, unsigned bsize)
}
#endif
+static int alloc_new_journal(int fd, unsigned bytes)
+{
+#define ALLOC_BUF_SIZE (4 << 20)
+ unsigned left = bytes;
+ int error;
+ char *buf;
+
+ error = fallocate(fd, 0, 0, bytes);
+ if (error == 0)
+ return 0;
+ if (errno != EOPNOTSUPP)
+ goto out_errno;
+
+ /* No fallocate support, fall back to writes */
+ buf = calloc(1, ALLOC_BUF_SIZE);
+ if (buf == NULL)
+ goto out_errno;
+
+ while (left > 0) {
+ unsigned sz = ALLOC_BUF_SIZE;
+
+ if (left < ALLOC_BUF_SIZE)
+ sz = left;
+
+ if (pwrite(fd, buf, sz, bytes - left) != sz) {
+ free(buf);
+ goto out_errno;
+ }
+ left -= sz;
+ }
+ free(buf);
+ return 0;
+out_errno:
+ perror("Failed to allocate space for new journal");
+ return -1;
+}
+
static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
{
int fd, error = 0;
@@ -490,14 +527,9 @@ static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
if ((error = set_flags(fd, JA_FL_CLEAR, FS_JOURNAL_DATA_FL)))
goto close_fd;
- memset(buf, 0, sdp->bsize);
- for (x=0; x<blocks; x++) {
- if (write(fd, buf, sdp->bsize) != sdp->bsize) {
- perror("add_j write");
- error = -1;
- goto close_fd;
- }
- }
+ error = alloc_new_journal(fd, sdp->jsize << 20);
+ if (error != 0)
+ goto close_fd;
if ((error = lseek(fd, 0, SEEK_SET)) < 0) {
perror("add_j lseek");

View File

@ -1,54 +0,0 @@
commit 11070364f04a111212efcc2604840eee71f32c8f
Author: Andrew Price <anprice@redhat.com>
Date: Thu Mar 18 17:50:16 2021 +0000
gfs2_jadd: Don't fsync after each block written
gfs2_jadd has always called fsync() after writing each block of the
journal. There doesn't seem to be any need for that so take the fsync()
call out of the loop.
Add an additional fsync() after preallocation to make sure we're in good
shape before writing the log headers.
In my tests this reduces the time to add one journal from 5 minutes to
9 seconds.
Resolves: rhbz#1942434
Signed-off-by: Andrew Price <anprice@redhat.com>
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index b0cffbac..6aff97c3 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -531,6 +531,11 @@ static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
if (error != 0)
goto close_fd;
+ error = fsync(fd);
+ if (error != 0) {
+ perror("Failed to sync journal metadata");
+ goto close_fd;
+ }
if ((error = lseek(fd, 0, SEEK_SET)) < 0) {
perror("add_j lseek");
goto close_fd;
@@ -574,12 +579,12 @@ static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
seq = 0;
off += sdp->bsize;
- if ((error = fsync(fd))) {
- perror("add_j fsync");
- goto close_fd;
- }
}
-
+ error = fsync(fd);
+ if (error != 0) {
+ perror("Failed to sync journal metadata");
+ goto close_fd;
+ }
sprintf(new_name, "journal%u", opts->journals);
error = rename2system(opts, opts->jindex, new_name);
if (error < 0 && errno != EEXIST){

View File

@ -1,134 +0,0 @@
commit 60e7c2bfcb23ddfcf2f63d8d8a700e871071a574
Author: Andrew Price <anprice@redhat.com>
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 <anprice@redhat.com>
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>"), _("Size of resource groups, in megabytes"),
"-t", _("<name>"), _("Name of the lock table"),
+ "-U", _("<UUID>"), _("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

View File

@ -1,492 +0,0 @@
###############################################################################
###############################################################################
##
## Copyright (C) 2004-2018 Red Hat, Inc. All rights reserved.
##
## This copyrighted material is made available to anyone wishing to use,
## modify, copy, or redistribute it subject to the terms and conditions
## of the GNU General Public License v.2.
##
###############################################################################
###############################################################################
Name: gfs2-utils
Version: 3.2.0
Release: 13%{?dist}
License: GPLv2+ and LGPLv2+
Group: System Environment/Kernel
Summary: Utilities for managing the global file system (GFS2)
%ifnarch %{arm}
%{?fedora:Requires: kmod(gfs2.ko) kmod(dlm.ko)}
%endif
BuildRequires: ncurses-devel
BuildRequires: kernel-headers
BuildRequires: automake
BuildRequires: libtool
BuildRequires: zlib-devel
BuildRequires: gettext-devel
BuildRequires: bison
BuildRequires: flex
BuildRequires: libblkid-devel
BuildRequires: libuuid-devel
BuildRequires: check-devel
Requires: lvm2-lockd
Source: https://releases.pagure.org/gfs2-utils/gfs2-utils-%{version}.tar.gz
URL: https://pagure.io/gfs2-utils
Patch0: bz1622050-1-fsck_gfs2_Don_t_check_fs_formats_we_don_t_recognise.patch
Patch1: bz1622050-2-libgfs2_Fix_pointer_cast_byte_order_issue.patch
Patch2: bz1659490-gfs2_utils_Wrong_hash_value_used_to_clean_journals.patch
Patch3: bz1698858-mkfs_gfs2_Improve_alignment_of_first_resource_group.patch
Patch4: bz1757115-gfs2_5_General_updates_and_layout_improvements.patch
Patch5: bz1693000-fsck_gfs2_8_Manpage_updates.patch
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
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}
%patch0 -p1 -b .bz1622050-1-fsck_gfs2_Don_t_check_fs_formats_we_don_t_recognise
%patch1 -p1 -b .bz1622050-2-libgfs2_Fix_pointer_cast_byte_order_issue
%patch2 -p1 -b .bz1659490-gfs2_utils_Wrong_hash_value_used_to_clean_journals
%patch3 -p1 -b .bz1698858-mkfs_gfs2_Improve_alignment_of_first_resource_group
%patch4 -p1 -b .bz1757115-gfs2_5_General_updates_and_layout_improvements
%patch5 -p1 -b .bz1693000-fsck_gfs2_8_Manpage_updates
%patch6 -p1 -b .bz1839219-mkfs_gfs2_Don_t_use_i_o_limits_hints_4K_for_block_size
%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
%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
%configure
make %{_smp_mflags} V=1
%check
make check || { cat tests/testsuite.log; exit 1; }
%install
make -C gfs2 install DESTDIR=%{buildroot}
# Don't ship gfs2_{trace,lockcapture} in this package
rm -f %{buildroot}/usr/sbin/gfs2_trace
rm -f %{buildroot}/usr/sbin/gfs2_lockcapture
rm -f %{buildroot}%{_mandir}/man8/gfs2_trace.8
rm -f %{buildroot}%{_mandir}/man8/gfs2_lockcapture.8
%description
The gfs2-utils package contains a number of utilities for creating, checking,
modifying, and correcting inconsistencies in GFS2 file systems.
%files
%doc doc/COPYING.* doc/COPYRIGHT doc/*.txt
%doc doc/README.contributing doc/README.licence
%{_sbindir}/fsck.gfs2
%{_sbindir}/gfs2_grow
%{_sbindir}/gfs2_jadd
%{_sbindir}/mkfs.gfs2
%{_sbindir}/gfs2_convert
%{_sbindir}/gfs2_edit
%{_sbindir}/tunegfs2
%{_sbindir}/gfs2_withdraw_helper
%{_sbindir}/glocktop
%{_mandir}/man8/*gfs2*
%{_mandir}/man8/glocktop*
%{_mandir}/man5/*
%{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules
%changelog
* Tue Mar 28 2023 Andrew Price <anprice@redhat.com> - 3.2.0-13
- Re-add tests that were dropped in the c8s migration
Resolves: rhbz#2180782
* Tue Mar 28 2023 Andrew Price <anprice@redhat.com> - 3.2.0-12
- mkfs.gfs2: Add -U UUID option
Resolves: rhbz#2180782
* Wed Mar 24 2021 Andrew Price <anprice@redhat.com> - 3.2.0-11
- gfs2_jadd: Use fallocate to preallocate journals
- gfs2_jadd: Don't fsync after each block written
Resolves: rhbz#1942434
* Thu Nov 12 2020 Andrew Price <anprice@redhat.com> - 3.2.0-10
- mkfs.gfs2: Tighten minimum journal size checks
Resolves: rhbz#1779806
* Tue Jun 09 2020 Andrew Price <anprice@redhat.com> - 3.2.0-9
- gfs2_jadd: Handle out-of-space issues
- gfs2_jadd: error handling overhaul
Resolves: rhbz#1833141
- gfs2.5: Update some mentions of gfs2_tool
Resolves: rhbz#1818983
* Tue Jun 02 2020 Andrew Price <anprice@redhat.com> - 3.2.0-8
- mkfs.gfs2: Don't use i/o limits hints <4K for block size
Resolves: rhbz#1839219
* Fri Oct 18 2019 Andrew Price <anprice@redhat.com> - 3.2.0-7
- fsck.gfs2(8): Manpage updates
Resolves: rhbz#1693000
* Wed Oct 16 2019 Andrew Price <anprice@redhat.com> - 3.2.0-6
- gfs2.5: General updates and layout improvements
Resolves: rhbz#1757115
* Fri May 03 2019 Andrew Price <anprice@redhat.com> - 3.2.0-5
- mkfs.gfs2: Improve alignment of first resource group
Resolves: rhbz#1698858
* Fri Dec 14 2018 Andrew Price <anprice@redhat.com> - 3.2.0-4
- gfs2-utils: Wrong hash value used to clean journals
Resolves: rhbz#1659490
* Thu Nov 01 2018 Andrew Price <anprice@redhat.com> - 3.2.0-3
- Require lvm2-lockd
Resolves: rhbz#1642272
* Mon Oct 01 2018 Andrew Price <anprice@redhat.com> - 3.2.0-2
- fsck.gfs2: Don't check fs formats we don't recognise
- libgfs2: Fix pointer cast byte order issue
Resolves: rhbz#1622050
* Thu May 24 2018 Andrew Price <anprice@redhat.com> - 3.2.0-1
- New upstream release
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.10-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Fri Oct 13 2017 Andrew Price <anprice@redhat.com> - 3.1.10-4
- Update URL in spec file
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Tue Mar 28 2017 Andrew Price <anprice@redhat.com> - 3.1.10-1
- New upstream release
- Make dependency on libuuid explicit
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jun 07 2016 Andrew Price <anprice@redhat.com> - 3.1.9-1
- New upstream release
- Drop all patches
- Add glocktop to the package
* Mon Feb 15 2016 Andrew Price <anprice@redhat.com> - 3.1.8-7
- libgfs2: Add support for dirent.de_rahead
- gfs2_edit: Include dirent.de_rahead in directory listings
- gfs2-utils: Add a check for the de_rahead field
- libgfs2: Support the new dirent de_cookie field
Resolves: bz#1307532
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.8-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Aug 20 2015 Andrew Price <anprice@redhat.com> - 3.1.8-5
- Add patches to install the withdraw helper script properly:
scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper.patch
scripts_install_the_withdraw_helper_script.patch
scripts_install_the_withdraw_udev_rules_script.patch
- Remove the obsolete udev script installation bits
* Tue Aug 11 2015 Andrew Price <anprice@redhat.com> - 3.1.8-4
- gfs2-utils: Fix hang on withdraw
- Install udev withdraw handler scripts
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Apr 18 2015 Andrew Price <anprice@redhat.com> - 3.1.8-2
- fsck.gfs2: replace recent i_goal fixes with simple logic
* Tue Apr 07 2015 Andrew Price <anprice@redhat.com> - 3.1.8-1
- New upstream release
- Remove perl dependency
- Update spec per the latest packaging guidelines
* Mon Sep 08 2014 Andrew Price <anprice@redhat.com> - 3.1.7-1
- New upstream release
- Drop all patches
- gfs2-utils tests: Build unit tests with consistent cpp flags
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.6-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.6-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Thu May 15 2014 Josh Boyer <jwboyer@fedoraproject.org> - 3.1.6-7
- Switch to using Requires on individual kernel modules
Resolves: bz#1056191
* Fri Mar 21 2014 Andrew Price <anprice@redhat.com> - 3.1.6-6
- gfs2_grow: Don't try to open an empty string
- libgfs2: Add lgfs2 open mnt functions
- Switch is pathname mounted callers to lgfs2 open mnt
- libgfs2 Remove is pathname mounted
Resolves: bz#1079286
* Fri Oct 04 2013 Andrew Price <anprice@redhat.com> - 3.1.6-5
- Suppress req on kernel-modules-extra for ARM arches.
* Tue Sep 17 2013 Andrew Price <anprice@redhat.com> - 3.1.6-4
- Don't use README.* for docs (it can pick up some patch files)
* Wed Aug 21 2013 Andrew Price <anprice@redhat.com> - 3.1.6-3
- Install utils into /usr/sbin instead of /sbin
Resolves: rhbz#996539
* Mon Jul 29 2013 Andrew Price <anprice@redhat.com> - 3.1.6-2
- Don't install gfs2_lockcapture and gfs2_trace
Resolves: rhbz#987019
- Run test suite after build (requires check-devel build req)
- Install both of the READMEs into doc/
* Wed Jul 24 2013 Andrew Price <anprice@redhat.com> - 3.1.6-1
- New upstream release
- Drop 'file' requirement - mkfs.gfs2 now uses libblkid instead
- Drop 'ncurses' requirement - dependency is added automatically
- Drop requires chkconfig and initscripts - no longer installs daemons
- Drop fix_build_on_rawhide.patch - upstream
- Add build req on libblkid-devel
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Tue Nov 13 2012 Andrew Price <anprice@redhat.com> - 3.1.5-1
- New upstream release
Removes mount.gfs2, gfs2_tool, gfs2_quota
- Remove rawhide_transition.patch - now obsolete
- Update BuildRequires:
Change glibc-kernheaders to kernel-headers
Add bison and flex
- Provide a valid url for Source0
- Add fix_build_on_rawhide.patch to fix a circular dep introduced in
bison 2.6, and a make -j race between libgfs2 and gfs2l
* Tue Aug 14 2012 Andrew Price <anprice@redhat.com> - 3.1.4-6
- Make the kernel-modules-extra requirement Fedora-specific
Resolves bz#847955
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Tue Apr 17 2012 Andrew Price <anprice@redhat.com> - 3.1.4-4
- Remove commented-out sections
- Clean up some lintian warnings
- Add dependency on kernel-modules-extra as per bz#811547
* Wed Mar 07 2012 Andrew Price <anprice@redhat.com> - 3.1.4-3
- Remove redundant postinstall scriptlet
* Thu Feb 2 2012 Fabio M. Di Nitto <fdinitto@redhat.com> - 3.1.4-2
- make sure to Obsolete gfs2-cluster
* Wed Feb 01 2012 Andrew Price <anprice@redhat.com> - 3.1.4-1
- New upstream release
Adds gfs2_lockgather script
- Remove gfs2-cluster (commented out for now)
- Remove dependency on corosynclib-devel and systemd-units
- Add rawhide_transition.patch to stop gfs_controld from building
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Thu Dec 15 2011 Andrew Price <anprice@redhat.com> - 3.1.3-1
- New upstream release
Bugfixes and improvements to fsck.gfs2
Fixes various other bugs
Improve strings and translation support
- Adds gfs2-cluster systemd unit
- Removes gfs2* init scripts
* Wed Jul 06 2011 Andrew Price <anprice@redhat.com> - 3.1.2-1
- New upstream release
Fixes several bugs
Improves translation support
Adds savemeta compression
- Add zlib-devel to BuildRequires
- Add gettext-devel to BuildRequires
* Wed May 25 2011 Steven Whitehouse <swhiteho@redhat.com> - 3.1.1-3
- Update wiki URL
- Remove gfs2_tool and gfs2_quota from package
* Fri Feb 25 2011 Bob Peterson <rpeterso@redhat.com> - 3.1.1-2
- Bumping release number to keep upgrades consistent.
* Wed Feb 23 2011 Bob Peterson <rpeterso@redhat.com> - 3.1.1-1
- gfs2_edit savemeta doesn't save all leafs for big directories
- gfs2_edit improvements
- fsck.gfs2: can't repair rgrps resulting from gfs_grow->gfs2_convert
- fsck.gfs2: reports master/root dinodes as unused and fixes bitmap
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Thu Jan 20 2011 Steven Whitehouse <swhiteho@redhat.com> - 3.1.0-4
- Drop mount.gfs2 and its man page
- Only list gfs2_tool once in the files list
* Wed Dec 8 2010 Fabio M. Di Nitto <fdinitto@redhat.com> - 3.1.0-3
- Drop circular dependency on cman
* Fri Dec 3 2010 Fabio M. Di Nitto <fdinitto@redhat.com> - 3.1.0-2
- gfs2-cluster should Obsoletes/Provides gfs-pcmk
* Tue Sep 30 2010 Steven Whitehouse <swhiteho@redhat.com> - 3.1.0-1
- Bringing this package back for upstream GFS2
Addition of gfs2tune to the utils
Merge of gfs_controld from cman
* Thu Jan 22 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 2.03.11-1
- New upstream release
Fix several bugs and drastically improve startup errors.
* Wed Dec 10 2008 Fabio M. Di Nitto <fdinitto@redhat.com> - 2.03.10-1
- New upstream release
Fix several bugs and port gfs1 code to match 2.6.27 kernel.
* Fri Oct 31 2008 Fabio M. Di Nitto <fdinitto@redhat.com> - 2.03.09-1
- New upstream release
Fix rhbz#468966
Addresses several security issues similar to CVE-2008-4192 and
CVE-2008-4579 after deep code audit from upstream
- cleanup patches to match 2.6.26 kernel in F-9
* Tue Oct 21 2008 Fabio M. Di Nitto <fdinitto@redhat.com> - 2.03.08-1
- New upstream release
Fix rhbz#460376 CVE-2008-4192
Fix rhbz#467386 CVE-2008-4579
- cleanup/update patches to match 2.6.26 kernel in F-9
* Thu Aug 14 2008 Fabio M. Di Nitto <fdinitto@redhat.com> - 2.03.07-1
- New upstream release
- Fix rgmanager startup locking issues
- Apply patch to include kernel headers from 2.6.26 required to build
userland. Userland will run in 2.6.25 compatibility mode
- Apply patch to keep kernel modules at 2.6.25 (upstream is at 2.6.26)
(this patch is purely cosmetic since we don't build kernel modules
but keep the source in sync is Good (tm))
- Cleanup packaging for installed docs and file permissions
* Mon Jul 14 2008 Fabio M. Di Nitto <fdinitto@redhat.com> - 2.03.05-1
- New upstream release
- Cleanup installed doc after upstream
* Wed Jun 11 2008 Fabio M. Di Nitto <fdinitto@redhat.com> 2.03.04-1
- New upstream release
- Resolves: #446995 #318271 #447378 #445662
- Update license tags after major upstream cleanup
- Include COPYRIGHT file
* Fri May 30 2008 Fabio M. Di Nitto <fdinitto@redhat.com> 2.03.03-1
- New upstream release
- Fix several build warnings
- Update spec files to use macros
- Update Requires to use packages rather than pointing at files
- Drop BR on kernel-devel since it's not required anymore
- Update build section to use proper _sysconfdir, libdir and sbindir
- Avoid abusing cd when we can ask make to do the work for us
- Remove /usr/sbin from file section. We don't have any file there
and we can avoid shipping stuff by mistake
* Mon Apr 14 2008 Steven Whitehouse <swhiteho@redhat.com> 2.03.00-3
- Fabbione saves the day. We can get rid of the sed stuff after all
* Mon Apr 14 2008 Steven Whitehouse <swhiteho@redhat.com> 2.03.00-1
- New upstream sources
- Eric Sandeen's solution to kernel version dep
* Wed Apr 09 2008 Steven Whitehouse <swhiteho@redhat.com> 0.1.25.2.02.01-15
- Remove obsolete chkconfig patch for initscript
- Enable parallel make
- Remove obsolete copy of gfs2_ondisk.h (this should be in glibc-kernheaders)
* Wed Apr 09 2008 Steven Whitehouse <swhiteho@redhat.com> 0.1.25.2.02.01-14
- Update URL
- Fix license spec
* Fri Mar 14 2008 Chris Feist <cfeist@redhat.com> 0.1.25.2.02.00-2
- New upstream sources.
* Tue Jan 16 2007 Chris Feist <cfeist@redhat.com> 0.1.24-1
- New upstream sources.
- Resolves: rhbz#222747
* Wed Jan 03 2007 Chris Feist <cfeist@redhat.com> 0.1.24-1
- Updated sources
- Resolves: rhbz#218560
* Thu Dec 21 2006 Chris Feist <cfeist@redhat.com> 0.1.23-1
- Updated sources
- Resolves: rhbz#218560
* Tue Dec 19 2006 Chris Feist <cfeist@redhat.com> 0.1.22-1
- New upstream sources.
- Resolves: rhbz#219878
* Tue Dec 04 2006 Chris Feist <cfeist@redhat.com> 0.1.21-1
- New upstream sources.
- Resolves: rhbz#218134 rhbz#215962
* Thu Nov 30 2006 Chris Feist <cfeist@redhat.com> 0.1.19-1
- New upstream sources.
- Resolves: rhbz#217798
* Wed Nov 29 2006 Chris Feist <cfeist@redhat.com> 0.1.18-1
- New upstream sources.
- Resolves: rhbz#217460
* Thu Oct 26 2006 Chris Feist <cfeist@redhat.com> 0.1.14-1
- New upstream sources.
* Fri Oct 13 2006 Chris Feist <cfeist@redhat.com> 0.1.12-1
- New Upstream sources.
* Fri Oct 13 2006 Chris Feist <cfeist@redhat.com> 0.1.10-1
- New Upstream sources.
* Mon Oct 09 2006 Chris Feist <cfeist@redhat.com> 0.1.9-1
- New Upstream sources.
* Mon Sep 25 2006 Chris Feist <cfeist@redhat.com> 0.1.8-1
- New Upstream sources.
* Wed Sep 13 2006 Chris Feist <cfeist@redhat.com> 0.1.7-1
- New Upstream sources.
* Thu Sep 07 2006 Chris Feist <cfeist@redhat.com> 0.1.6-2
- Fix typo in uninstall script (turn off gfs2 instead of gfs)
* Mon Aug 28 2006 Chris Feist <cfeist@redhat.com> 0.1.6-1
- New Upstream sources.
* Tue Aug 22 2006 Chris Feist <cfeist@redhat.com> 0.1.5-1
- New Upstream sources.
* Mon Aug 14 2006 Chris Feist <cfeist@redhat.com> 0.1.3-0
- New Upstream sources, use dist tag.
* Fri Jul 14 2006 Chris Feist <cfeist@redhat.com>
- Rebuild with updated sources
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com>
- rebuild
* Tue Jun 27 2006 Florian La Roche <laroche@redhat.com>
- fix typo in preun script
* Fri Jun 09 2006 Chris Feist <cfeist@redhat.com> - 0.1.0-1.fc6.3
- Initial build of gfs-utils.

15
gating.yaml Normal file
View File

@ -0,0 +1,15 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

253
gfs2-utils.spec Normal file
View File

@ -0,0 +1,253 @@
Name: gfs2-utils
Version: 3.5.1
Release: 2%{?dist}
License: GPLv2+ and LGPLv2+
Summary: Utilities for managing the global file system (GFS2)
%ifnarch %{arm}
%{?fedora:Recommends: kmod(gfs2.ko) kmod(dlm.ko)}
%endif
BuildRequires: ncurses-devel
BuildRequires: kernel-headers
BuildRequires: automake
BuildRequires: libtool
BuildRequires: zlib-devel
BuildRequires: gettext-devel
BuildRequires: bison
BuildRequires: flex
BuildRequires: libblkid-devel
BuildRequires: libuuid-devel
BuildRequires: check-devel
BuildRequires: bzip2-devel
BuildRequires: make
Source: https://releases.pagure.org/gfs2-utils/gfs2-utils-%{version}.tar.gz
URL: https://pagure.io/gfs2-utils
Patch0: RHEL-26661-gfs2_edit_truncate_to_filesystem_size_at_end_of_restoremeta.patch
%prep
%autosetup -p1
%build
./autogen.sh
%configure
%make_build
%check
make check || { cat tests/testsuite.log; exit 1; }
%install
%make_install
# Don't ship gfs2_{trace,lockcapture} in this package
rm -f %{buildroot}/usr/sbin/gfs2_trace
rm -f %{buildroot}/usr/sbin/gfs2_lockcapture
rm -f %{buildroot}%{_mandir}/man8/gfs2_trace.8
rm -f %{buildroot}%{_mandir}/man8/gfs2_lockcapture.8
%description
The gfs2-utils package contains a number of utilities for creating, checking,
modifying, and correcting inconsistencies in GFS2 file systems.
%files
%doc doc/COPYING.* doc/COPYRIGHT doc/*.txt
%doc doc/README.contributing doc/README.licence
%{_sbindir}/fsck.gfs2
%{_sbindir}/gfs2_grow
%{_sbindir}/gfs2_jadd
%{_sbindir}/mkfs.gfs2
%{_sbindir}/gfs2_convert
%{_sbindir}/gfs2_edit
%{_sbindir}/tunegfs2
%{_sbindir}/glocktop
%{_libexecdir}/gfs2_withdraw_helper
%{_mandir}/man8/*gfs2*
%{_mandir}/man8/glocktop*
%{_mandir}/man5/*
%{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules
%changelog
* Fri Jun 21 2024 Andrew Price <anprice@redhat.com> - 3.5.1-2
- gfs2_edit: truncate to filesystem size at end of restoremeta()
Resolves: RHEL-26661
- Update tests/testsuite
* Tue Apr 11 2023 Andrew Price <anprice@redhat.com> - 3.5.1-1
- New upstream release
- Drop patches
- Re-enabled LTO
Resolves: rhbz#2170017
* Mon Feb 27 2023 Andrew Price <anprice@redhat.com> - 3.5.0-1
- New upstream version
Resolves: rhbz#2170017
- Update tests
- Disable LTO to fix unit test breakage in el9
- gfs2_edit: Fix savemeta test failures in 32-bit environments
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 3.4.1-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Tue May 11 2021 Andrew Price <anprice@redhat.com> - 3.4.1-3
- Rebuild for kernel 5.12 headers
Resolves: rhbz#1616432
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 3.4.1-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Mon Mar 15 2021 Andrew Price <anprice@redhat.com> - 3.4.1-1
- New upstream version
* Mon Mar 08 2021 Andrew Price <anprice@redhat.com> - 3.4.0-1
- New upstream version
- Update testsuite script
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Sep 03 2020 Andrew Price <anprice@redhat.com> - 3.3.0-2
- Version bump to enable gating tests
* Tue Sep 01 2020 Andrew Price <anprice@redhat.com> - 3.3.0-1
- New upstream version
- Add dependency on bzip2
- Drop all patches
- gfs2_withdraw_helper is now in /usr/libexec/
* Wed Jul 29 2020 Andrew Price <anprice@redhat.com> - 3.2.0-10
- tests: Don't use fail_unless in unit tests
Fixes build failures due to a regression in check-devel
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 21 2020 Andrew Price <anprice@redhat.com> - 3.2.0-8
- Use make_build and make_install macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
- Remove -C gfs2 - it's a remnant from the cluster.git days
- Remove unnecessary header notice from spec file
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Feb 04 2019 Andrew Price <anprice@redhat.com> - 3.2.0-5
- Fix libuuid linking
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jun 21 2018 Andrew Price <anprice@redhat.com> - 3.2.0-2
- Recommend the gfs2 and dlm kmods instead of requiring them
Resolves: bz#1593411
* Thu May 24 2018 Andrew Price <anprice@redhat.com> - 3.2.0-1
- New upstream release
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.10-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Fri Oct 13 2017 Andrew Price <anprice@redhat.com> - 3.1.10-4
- Update URL in spec file
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Tue Mar 28 2017 Andrew Price <anprice@redhat.com> - 3.1.10-1
- New upstream release
- Make dependency on libuuid explicit
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jun 07 2016 Andrew Price <anprice@redhat.com> - 3.1.9-1
- New upstream release
- Drop all patches
- Add glocktop to the package
* Mon Feb 15 2016 Andrew Price <anprice@redhat.com> - 3.1.8-7
- libgfs2: Add support for dirent.de_rahead
- gfs2_edit: Include dirent.de_rahead in directory listings
- gfs2-utils: Add a check for the de_rahead field
- libgfs2: Support the new dirent de_cookie field
Resolves: bz#1307532
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.8-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Aug 20 2015 Andrew Price <anprice@redhat.com> - 3.1.8-5
- Add patches to install the withdraw helper script properly:
scripts_rename_gfs2_wd_udev_sh_to_gfs2_withdraw_helper.patch
scripts_install_the_withdraw_helper_script.patch
scripts_install_the_withdraw_udev_rules_script.patch
- Remove the obsolete udev script installation bits
* Tue Aug 11 2015 Andrew Price <anprice@redhat.com> - 3.1.8-4
- gfs2-utils: Fix hang on withdraw
- Install udev withdraw handler scripts
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Apr 18 2015 Andrew Price <anprice@redhat.com> - 3.1.8-2
- fsck.gfs2: replace recent i_goal fixes with simple logic
* Tue Apr 07 2015 Andrew Price <anprice@redhat.com> - 3.1.8-1
- New upstream release
- Remove perl dependency
- Update spec per the latest packaging guidelines
* Mon Sep 08 2014 Andrew Price <anprice@redhat.com> - 3.1.7-1
- New upstream release
- Drop all patches
- gfs2-utils tests: Build unit tests with consistent cpp flags
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.6-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.6-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Thu May 15 2014 Josh Boyer <jwboyer@fedoraproject.org> - 3.1.6-7
- Switch to using Requires on individual kernel modules
Resolves: bz#1056191
* Fri Mar 21 2014 Andrew Price <anprice@redhat.com> - 3.1.6-6
- gfs2_grow: Don't try to open an empty string
- libgfs2: Add lgfs2 open mnt functions
- Switch is pathname mounted callers to lgfs2 open mnt
- libgfs2 Remove is pathname mounted
Resolves: bz#1079286
* Fri Oct 04 2013 Andrew Price <anprice@redhat.com> - 3.1.6-5
- Suppress req on kernel-modules-extra for ARM arches.
* Tue Sep 17 2013 Andrew Price <anprice@redhat.com> - 3.1.6-4
- Don't use README.* for docs (it can pick up some patch files)
* Wed Aug 21 2013 Andrew Price <anprice@redhat.com> - 3.1.6-3
- Install utils into /usr/sbin instead of /sbin
Resolves: rhbz#996539
* Mon Jul 29 2013 Andrew Price <anprice@redhat.com> - 3.1.6-2
- Don't install gfs2_lockcapture and gfs2_trace
Resolves: rhbz#987019
- Run test suite after build (requires check-devel build req)
- Install both of the READMEs into doc/
* Wed Jul 24 2013 Andrew Price <anprice@redhat.com> - 3.1.6-1
- New upstream release
- Drop 'file' requirement - mkfs.gfs2 now uses libblkid instead
- Drop 'ncurses' requirement - dependency is added automatically
- Drop requires chkconfig and initscripts - no longer installs daemons
- Drop fix_build_on_rawhide.patch - upstream
- Add build req on libblkid-devel
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (gfs2-utils-3.5.1.tar.gz) = 08c7b1870b1fb76496f7ab4ce3c121e4e5f5a37760831536817ed880ef030d765a533c53ba9913ae080b4a98b4efaffa112fcf92acd4e939199d1dae8d0e6f9b

17
tests/atlocal Normal file
View File

@ -0,0 +1,17 @@
GFS_TGT="${abs_top_builddir}/tests/testvol"
GFS_TGT_SZ=20
GFS_MKFS="mkfs.gfs2 -O -D"
gfs_max_blocks()
{
printf $((GFS_TGT_SZ*1073741824/$1))
}
gfs_tgt_cleanup()
{
if $1; then
rm -f $GFS_TGT
fi
}
trap 'gfs_tgt_cleanup $at_arg_always_clean_testvol' EXIT

20
tests/rgrifieldscheck.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
dev=$1
i=0
gfs2_edit -p rg 0 $dev | grep rg_data0 > /dev/null 2>&1
# New fields not present in /usr/include/linux/gfs2_ondisk.h
test $? = 0 || exit 0
gfs2_edit -p rindex $dev | while read field rival unused
do
test $field = ri_data0 -o $field = ri_data -o $field = ri_bitbytes || continue
rgfield=$(echo $field | sed 's/ri/rg/')
rgval=$(gfs2_edit -p rg $i $dev | grep " $rgfield " | awk '{print $2}')
if test "$rival" != "$rgval"
then
echo "Bad $rgfield in rg $i: $rgval (expected: $rival)" >&2
exit 1
fi
test $field = ri_bitbytes && i=$((i+1))
done

19
tests/rgskipcheck.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
dev=$1
rgcount=$(gfs2_edit -p rgcount $dev | cut -f1 -d' ')
prevaddr=$(gfs2_edit -p rg 0 $dev | grep ^RG | awk '{print $5}')
prevskip=0
for i in `seq 0 $(($rgcount - 1))`; do
addr=$(gfs2_edit -p rg $i $dev | grep ^RG | awk '{print $5}')
expected=$(($addr - $prevaddr))
if test $prevskip != $expected; then
echo "Bad rg_skip in rg $(($i - 1)): $prevskip (expected: $expected)" >&2
exit 1
fi
prevskip=$(gfs2_edit -p rg $i $dev | grep rg_skip | awk '{print $2}')
prevaddr=$addr
done

11
tests/tests.yml Normal file
View File

@ -0,0 +1,11 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
environment:
PATH: ".:{{ ansible_env.PATH }}"
tests:
- upstream_test_suite:
dir: .
run: ./testsuite

6610
tests/testsuite Executable file

File diff suppressed because it is too large Load Diff