[gfs2-utils] 10/10: gfs2_jadd: Don't fsync after each block written
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit 11070364f04a111212efcc2604840eee71f32c8f
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: 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(a)redhat.com>
---
gfs2/mkfs/main_jadd.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
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){
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 09/10: gfs2_jadd: Use fallocate to preallocate journals
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit 13e09a3519cc7cbf9417acc86a6d046bdba71a9f
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: 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(a)redhat.com>
---
gfs2/mkfs/main_jadd.c | 48 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 40 insertions(+), 8 deletions(-)
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");
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 08/10: mkfs.gfs2: Tighten minimum journal size checks
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit f335f362593786290baa7650f5e02b5e8e979431
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: 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(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 8 +++++++-
tests/mkfs.at | 2 ++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 412d4701..09e756fb 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -921,11 +921,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 42205679..e7ce8e80 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])
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 07/10: gfs2.5: Update some mentions of gfs2_tool
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit 6a5d984b2d5deb989faae2ce567e886b400f257d
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: 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(a)redhat.com>
---
gfs2/man/gfs2.5 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 06/10: gfs2_jadd: error handling overhaul
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit c1348933ea8ff59d21eab11f245940fc990cc1ae
Author: Abhi Das <adas(a)redhat.com>
AuthorDate: 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(a)redhat.com>
---
gfs2/mkfs/main_jadd.c | 404 ++++++++++++++++++++++++++++----------------------
1 file changed, 223 insertions(+), 181 deletions(-)
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);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 05/10: gfs2_jadd: Handle out-of-space issues
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit 698367f19d1c1bf31bc2dd37b6651a62c8dc7729
Author: Abhi Das <adas(a)redhat.com>
AuthorDate: 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(a)redhat.com>
---
gfs2/mkfs/main_jadd.c | 47 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 44 insertions(+), 3 deletions(-)
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;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 04/10: mkfs.gfs2: Don't use i/o limits hints <4K for
block size
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit a6e19b410ef13c4a8472ba356360dff07c019664
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: 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(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 2 +-
tests/mkfs.at | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
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 3e3fb82b..42205679 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.
])
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 03/10: fsck.gfs2(8): Manpage updates
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit 04432e7377cc948903a2982b00630284f86b71a6
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: 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
Resolves: rhbz#1693000
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/man/fsck.gfs2.8 | 43 ++++++++++++++++++++-----------------------
1 file changed, 20 insertions(+), 23 deletions(-)
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)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 02/10: gfs2.5: General updates and layout improvements
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit 6b27078b9f90c1a4912594cdb49dab2b9b7c5c8a
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: 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.
Resolves: rhbz#1757115
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/man/gfs2.5 | 239 +++++++++++---------------------------------------------
1 file changed, 44 insertions(+), 195 deletions(-)
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),
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 01/10: mkfs.gfs2: Improve alignment of first resource
group
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL8
in repository gfs2-utils.
commit 98c1765d10da01296687cc30cd681d964a8f82eb
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: 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(a)redhat.com>
---
gfs2/libgfs2/rgrp.c | 2 +-
tests/mkfs.at | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 190715e1..ad044d0e 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 ee444f50..3e3fb82b 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])
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years