gfs2-utils: RHEL7 - fsck.gfs2: Print out block number when pass3 finds a bad directory
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=e8590281...
Commit: e85902814022324dda6dce30df30e30efbced2c8
Parent: 4e0f9f4761f6cc41a0ad74b0b30d9264fe6c0ce0
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed Dec 17 10:22:25 2014 -0600
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:35 2015 +0100
fsck.gfs2: Print out block number when pass3 finds a bad directory
This patch changes pass3 so that it prints out the directory inode
number when it finds a directory containing a bad block.
---
gfs2/fsck/pass3.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index 167dac0..3e183e5 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -249,7 +249,10 @@ int pass3(struct gfs2_sbd *sdp)
q = block_type(di->dinode.no_addr);
if (q == gfs2_bad_block) {
log_err( _("Found unlinked directory "
- "containing bad block\n"));
+ "containing bad block at block %llu"
+ " (0x%llx)\n"),
+ (unsigned long long)di->dinode.no_addr,
+ (unsigned long long)di->dinode.no_addr);
if (query(_("Clear unlinked directory "
"with bad blocks? (y/n) "))) {
log_warn( _("inode %lld (0x%llx) is "
9 years
gfs2-utils: RHEL7 - fsck.gfs2: Change basic dentry checks for too long of file names
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=4e0f9f47...
Commit: 4e0f9f4761f6cc41a0ad74b0b30d9264fe6c0ce0
Parent: a1c46f990cff3c45164272fc0e720440b47a716c
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Nov 11 14:40:39 2014 -0600
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:35 2015 +0100
fsck.gfs2: Change basic dentry checks for too long of file names
This patch adds a check to the basic dentry check such that it will reject
any dirents that have a file name more than the maximum allowed.
---
gfs2/fsck/pass2.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 3c10fef..631dc56 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -468,7 +468,8 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct gfs2_dirent *dent,
}
}
- if (de->de_rec_len < GFS2_DIRENT_SIZE(de->de_name_len)) {
+ if (de->de_rec_len < GFS2_DIRENT_SIZE(de->de_name_len) ||
+ de->de_name_len > GFS2_FNAMESIZE) {
log_err( _("Dir entry with bad record or name length\n"
"\tRecord length = %u\n\tName length = %u\n"),
de->de_rec_len, de->de_name_len);
@@ -476,9 +477,12 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct gfs2_dirent *dent,
log_err( _("Directory entry not fixed.\n"));
return 0;
}
+ /* Don't be tempted to do this:
fsck_blockmap_set(ip, ip->i_di.di_num.no_addr,
_("corrupt directory entry"),
gfs2_inode_invalid);
+ We can't free it because another dir may have a valid reference
+ to it. Just return 1 so we can delete the bad dirent. */
log_err( _("Bad directory entry deleted.\n"));
return 1;
}
9 years
gfs2-utils: RHEL7 - gfs2-utils configure: Use AC_HELP_STRING in help messages
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=a1c46f99...
Commit: a1c46f990cff3c45164272fc0e720440b47a716c
Parent: 9dd8355b08582f4ee2028a093663d868a6a29c4a
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Sat Nov 1 14:20:22 2014 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:35 2015 +0100
gfs2-utils configure: Use AC_HELP_STRING in help messages
This makes it easier to keep text alignment in ./configure --help. Also
re-word an error message.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index e70409c..2341730 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ esac
# check stolen from gnulib/m4/gnu-make.m4
if ! ${MAKE-make} --version /cannot/make/this >/dev/null 2>&1; then
- AC_MSG_ERROR([you don't seem to have GNU make; it is required])
+ AC_MSG_ERROR([GNU make was not found but is required.])
fi
AC_PROG_CC
@@ -87,11 +87,11 @@ check_lib_no_libs() {
# local options
AC_ARG_ENABLE([debug],
- [ --enable-debug enable debug build. ],
- [ default="no" ])
+ AC_HELP_STRING([--enable-debug],[enable debug build [default=no]]),
+ [default="no"])
AC_ARG_ENABLE([gcov],
- [ --enable-gcov enable coverage instrumentation.],
- [ default="no" ])
+ AC_HELP_STRING([--enable-gcov],[enable coverage instrumentation [default=no]]),
+ [default="no"])
# We use the Check framework for unit tests
PKG_CHECK_MODULES([check], [check >= 0.9.8],
9 years
gfs2-utils: RHEL7 - gfs2-utils: Honour --sbindir
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=9dd8355b...
Commit: 9dd8355b08582f4ee2028a093663d868a6a29c4a
Parent: 1129c5a52b7fbed02d17d5eecaae3544d2282231
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Sat Nov 1 13:48:53 2014 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:35 2015 +0100
gfs2-utils: Honour --sbindir
If the user specifies --sbindir=foo then we should honour it.
fsck/Makefile.am and scripts/Makefile.am were the only remaining
directories with this shell snippet.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/Makefile.am | 8 --------
gfs2/scripts/Makefile.am | 9 ---------
2 files changed, 0 insertions(+), 17 deletions(-)
diff --git a/gfs2/fsck/Makefile.am b/gfs2/fsck/Makefile.am
index 92d56f3..b34833b 100644
--- a/gfs2/fsck/Makefile.am
+++ b/gfs2/fsck/Makefile.am
@@ -1,13 +1,5 @@
MAINTAINERCLEANFILES = Makefile.in
-# When an exec_prefix setting would have us install into /usr/sbin,
-# use /sbin instead.
-# Accept an existing sbindir value of /usr/sbin (probably for older automake),
-# or an empty value, for automake-1.11 and newer.
-sbindir := $(shell rpl=0; test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
- || test '$(exec_prefix):$(sbindir)' = /usr: && rpl=1; \
- test $$rpl = 1 && echo /sbin || echo '$(exec_prefix)/sbin')
-
sbin_PROGRAMS = fsck.gfs2
noinst_HEADERS = fsck.h fs_recovery.h \
diff --git a/gfs2/scripts/Makefile.am b/gfs2/scripts/Makefile.am
index 2c51222..1c98f95 100644
--- a/gfs2/scripts/Makefile.am
+++ b/gfs2/scripts/Makefile.am
@@ -1,12 +1,3 @@
MAINTAINERCLEANFILES = Makefile.in
-# When an exec_prefix setting would have us install into /usr/sbin,
-# use /sbin instead.
-# Accept an existing sbindir value of /usr/sbin (probably for older automake),
-# or an empty value, for automake-1.11 and newer.
-sbindir := $(shell rpl=0; test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
- || test '$(exec_prefix):$(sbindir)' = /usr: && rpl=1; \
- test $$rpl = 1 && echo /sbin || echo '$(exec_prefix)/sbin')
-
-
dist_sbin_SCRIPTS = gfs2_lockcapture gfs2_trace
9 years
gfs2-utils: RHEL7 - Build gfs2_grow, gfs2_jadd and mkfs.gfs2 separately
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=1129c5a5...
Commit: 1129c5a52b7fbed02d17d5eecaae3544d2282231
Parent: 716ff3208ab771a6f722d034b07e6ff380449dc9
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Sat Nov 1 13:22:43 2014 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:34 2015 +0100
Build gfs2_grow, gfs2_jadd and mkfs.gfs2 separately
Previously gfs2_jadd and gfs2_grow were just symlinks to mkfs.gfs2
created on installation, and mkfs.gfs2's main() function called the
appropriate main_* function depending on argv[0]. This had many
drawbacks:
- The lack of separate binaries complicated build testing and manual
linking was needed
- A perl snippet was needed to find the relative path to the mkfs.gfs2
binary on installation, making gfs2-utils build-dependent on perl
- This approach actually required more lines of code as the amount of
shared code was minimal
- It meant copying mkfs.gfs2 to, say, mkfs.gfs2.old caused it to die
with "Unknown mode"
This patch removes mkfs/main.c and gives each tool its own main(),
adding back locale setup code and #includes where needed. It also
removes the perl dependency and gives each tool its build target. The
above drawbacks are now solved, with the only overhead being a slightly
increased installed size. The tools can easily share more code in
future, but sharing main() is not the right way to do that.
Some code has been removed from Makefile.am in order to honour the
configure script's --sbindir option. An obsolete mkfs/README is also
removed.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
.gitignore | 2 +
gfs2/mkfs/Makefile.am | 53 +++++++++++++++++++---------------------------
gfs2/mkfs/README | 25 ---------------------
gfs2/mkfs/gfs2_mkfs.h | 11 +++++++++
gfs2/mkfs/main.c | 56 -------------------------------------------------
gfs2/mkfs/main_grow.c | 9 ++++++-
gfs2/mkfs/main_jadd.c | 9 +++++++-
gfs2/mkfs/main_mkfs.c | 22 +++++++------------
po/POTFILES.in | 1 -
9 files changed, 58 insertions(+), 130 deletions(-)
diff --git a/.gitignore b/.gitignore
index 4ffdb71..60ea971 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,8 @@ gfs2/libgfs2/lexer.c
gfs2/libgfs2/lexer.h
gfs2/fsck/fsck.gfs2
gfs2/mkfs/mkfs.gfs2
+gfs2/mkfs/gfs2_grow
+gfs2/mkfs/gfs2_jadd
gfs2/tune/tunegfs2
test-driver
tests/check_meta
diff --git a/gfs2/mkfs/Makefile.am b/gfs2/mkfs/Makefile.am
index 6ed89fa..822b41e 100644
--- a/gfs2/mkfs/Makefile.am
+++ b/gfs2/mkfs/Makefile.am
@@ -1,38 +1,29 @@
-MAINTAINERCLEANFILES = Makefile.in
+MAINTAINERCLEANFILES = Makefile.in
-# When an exec_prefix setting would have us install into /usr/sbin,
-# use /sbin instead.
-# Accept an existing sbindir value of /usr/sbin (probably for older automake),
-# or an empty value, for automake-1.11 and newer.
-sbindir := $(shell rpl=0; test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
- || test '$(exec_prefix):$(sbindir)' = /usr: && rpl=1; \
- test $$rpl = 1 && echo /sbin || echo '$(exec_prefix)/sbin')
+COMMON_CPPFLAGS = \
+ -D_FILE_OFFSET_BITS=64 \
+ -D_LARGEFILE64_SOURCE \
+ -D_GNU_SOURCE \
+ -I$(top_srcdir)/gfs2/include \
+ -I$(top_srcdir)/gfs2/libgfs2
+sbin_PROGRAMS = mkfs.gfs2 gfs2_jadd gfs2_grow
-sbin_PROGRAMS = mkfs.gfs2
+noinst_HEADERS = gfs2_mkfs.h
-noinst_HEADERS = gfs2_mkfs.h
+mkfs_gfs2_SOURCES = main_mkfs.c
+mkfs_gfs2_CPPFLAGS = $(COMMON_CPPFLAGS)
+mkfs_gfs2_CFLAGS = $(blkid_CFLAGS)
+mkfs_gfs2_LDFLAGS = $(blkid_LIBS)
+mkfs_gfs2_LDADD = $(top_builddir)/gfs2/libgfs2/libgfs2.la
-mkfs_gfs2_SOURCES = main.c main_grow.c main_jadd.c main_mkfs.c
+gfs2_grow_SOURCES = main_grow.c
+gfs2_grow_CPPFLAGS = $(COMMON_CPPFLAGS)
+gfs2_grow_CFLAGS = $(blkid_CFLAGS)
+gfs2_grow_LDFLAGS = $(blkid_LIBS)
+gfs2_grow_LDADD = $(top_builddir)/gfs2/libgfs2/libgfs2.la
-mkfs_gfs2_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE \
- -D_GNU_SOURCE \
- -I$(top_srcdir)/gfs2/include \
- -I$(top_srcdir)/gfs2/libgfs2
+gfs2_jadd_SOURCES = main_jadd.c
+gfs2_jadd_CPPFLAGS = $(COMMON_CPPFLAGS)
+gfs2_jadd_LDADD = $(top_builddir)/gfs2/libgfs2/libgfs2.la
-mkfs_gfs2_CFLAGS = $(blkid_CFLAGS)
-mkfs_gfs2_LDFLAGS = $(blkid_LIBS)
-
-mkfs_gfs2_LDADD = $(top_builddir)/gfs2/libgfs2/libgfs2.la
-
-relative_sbin = $(shell perl -MFile::Spec -le 'print File::Spec->abs2rel("/sbin", "$(sbindir)")')
-
-install-exec-hook:
- $(INSTALL) -d $(DESTDIR)/$(sbindir)
- cd $(DESTDIR)/$(sbindir) && \
- rm -f gfs2_grow gfs2_jadd && \
- $(LN_S) $(relative_sbin)/mkfs.gfs2 gfs2_grow && \
- $(LN_S) $(relative_sbin)/mkfs.gfs2 gfs2_jadd
-
-uninstall-hook:
- cd $(DESTDIR)/$(sbindir) && rm -f gfs2_jadd gfs2_grow
diff --git a/gfs2/mkfs/README b/gfs2/mkfs/README
deleted file mode 100644
index 784df7d..0000000
--- a/gfs2/mkfs/README
+++ /dev/null
@@ -1,25 +0,0 @@
-
-#
-# mkfs for GFS2 filesystem
-#
-
-To install:
-
- 1. Edit the Makefile to point at your local copy of the kernel source
-with GFS2 included in it, for my set up that means:
-
-INCLUDEPATH=-I/home/steve/linux-2.6/include/
-
- 2. make
- 3. make install
-
-
-You can then use it just like other mkfs programs (for example):
-
-/sbin/mkfs -t gfs2 -j 1 -p lock_nolock /dev/sdb1
-
-This will create a filesystem with one journal (i.e. mountable by a
-maximum of one node at a time) with the nolock module (single node
-use only) on /dev/sdb1. Running mkfs -f gfs2 -h will produce help
-information.
-
diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
index 3c63858..377c14b 100644
--- a/gfs2/mkfs/gfs2_mkfs.h
+++ b/gfs2/mkfs/gfs2_mkfs.h
@@ -29,6 +29,17 @@ void die(const char *fmt, ...)
exit(-1);
}
+/* This function is for libgfs2's sake. */
+void print_it(const char *label, const char *fmt, const char *fmt2, ...)
+{
+ va_list args;
+
+ va_start(args, fmt2);
+ printf("%s: ", label);
+ vprintf(fmt, args);
+ va_end(args);
+}
+
/*
* The following inode IOCTL macros and inode flags
* are copied from linux/fs.h, because we have duplicate
diff --git a/gfs2/mkfs/main.c b/gfs2/mkfs/main.c
deleted file mode 100644
index c0be01e..0000000
--- a/gfs2/mkfs/main.c
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "clusterautoconfig.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-#include <libgen.h>
-#include <libintl.h>
-#include <locale.h>
-#define _(String) gettext(String)
-
-#include <linux/types.h>
-#include "libgfs2.h"
-#include "gfs2_mkfs.h"
-
-/**
- * main - do everything
- * @argc:
- * @argv:
- *
- * Returns: 0 on success, non-0 on failure
- */
-
-int
-main(int argc, char *argv[])
-{
- char *p, *whoami;
-
- setlocale(LC_ALL, "");
- textdomain("gfs2-utils");
-
- srandom(time(NULL) ^ getpid());
-
- p = strdup(argv[0]);
- whoami = basename(p);
-
- if (!strcmp(whoami, "gfs2_jadd"))
- main_jadd(argc, argv);
- else if (!strcmp(whoami, "gfs2_mkfs") || !strcmp(whoami, "mkfs.gfs2"))
- main_mkfs(argc, argv);
- else if (!strcmp(whoami, "gfs2_grow"))
- main_grow(argc, argv);
- else
- die( _("Unknown mode\n"));
-
- free(p);
-
- return 0;
-}
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 33618de..3ab8e72 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -21,6 +21,7 @@
#include <linux/falloc.h>
#include <blkid.h>
#include <libintl.h>
+#include <locale.h>
#define _(String) gettext(String)
#include <logging.h>
@@ -338,13 +339,17 @@ static int open_rindex(char *metafs_path, int mode)
return fd;
}
-void main_grow(int argc, char *argv[])
+int main(int argc, char *argv[])
{
struct gfs2_sbd sbd, *sdp = &sbd;
int rindex_fd;
int error = EXIT_SUCCESS;
int devflags = (test ? O_RDONLY : O_RDWR) | O_CLOEXEC;
+ setlocale(LC_ALL, "");
+ textdomain("gfs2-utils");
+ srandom(time(NULL) ^ getpid());
+
memset(sdp, 0, sizeof(struct gfs2_sbd));
sdp->bsize = GFS2_DEFAULT_BSIZE;
sdp->rgsize = -1;
@@ -464,5 +469,5 @@ void main_grow(int argc, char *argv[])
exit(1);
}
log_notice( _("gfs2_grow complete.\n"));
- exit(error);
+ return error;
}
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index 6507e03..fea474a 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -18,6 +18,7 @@
#include <errno.h>
#include <stdarg.h>
#include <libintl.h>
+#include <locale.h>
#define _(String) gettext(String)
#include <linux/types.h>
@@ -486,13 +487,17 @@ static void add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
}
}
-void main_jadd(int argc, char *argv[])
+int main(int argc, char *argv[])
{
struct jadd_opts opts = {0};
struct gfs2_sbd sbd, *sdp = &sbd;
struct mntent *mnt;
unsigned int total;
+ setlocale(LC_ALL, "");
+ textdomain("gfs2-utils");
+ srandom(time(NULL) ^ getpid());
+
memset(sdp, 0, sizeof(struct gfs2_sbd));
sdp->jsize = GFS2_DEFAULT_JSIZE;
sdp->qcsize = GFS2_DEFAULT_QCSIZE;
@@ -549,4 +554,6 @@ void main_jadd(int argc, char *argv[])
cleanup_metafs(sdp);
sync();
print_results(&opts);
+
+ return 0;
}
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 282878d..2590ec8 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -21,6 +21,7 @@
#include <sys/ioctl.h>
#include <limits.h>
#include <blkid.h>
+#include <locale.h>
#define _(String) gettext(String)
@@ -28,19 +29,6 @@
#include "libgfs2.h"
#include "gfs2_mkfs.h"
-/**
- * This function is for libgfs2's sake.
- */
-void print_it(const char *label, const char *fmt, const char *fmt2, ...)
-{
- va_list args;
-
- va_start(args, fmt2);
- printf("%s: ", label);
- vprintf(fmt, args);
- va_end(args);
-}
-
static void print_usage(const char *prog_name)
{
int i;
@@ -871,7 +859,7 @@ static void open_dev(struct mkfs_dev *dev)
exit(1);
}
-void main_mkfs(int argc, char *argv[])
+int main(int argc, char *argv[])
{
struct gfs2_sbd sbd;
struct gfs2_sb sb;
@@ -880,6 +868,10 @@ void main_mkfs(int argc, char *argv[])
int error;
unsigned bsize;
+ setlocale(LC_ALL, "");
+ textdomain("gfs2-utils");
+ srandom(time(NULL) ^ getpid());
+
opts_init(&opts);
opts_get(argc, argv, &opts);
opts_check(&opts);
@@ -1001,4 +993,6 @@ void main_mkfs(int argc, char *argv[])
if (!opts.quiet)
print_results(&sb, &opts, sbd.rgrps, sbd.fssize);
+
+ return 0;
}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 579ff4b..0e5f57e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,5 @@
gfs2/mkfs/main_mkfs.c
gfs2/mkfs/gfs2_mkfs.h
-gfs2/mkfs/main.c
gfs2/mkfs/main_grow.c
gfs2/mkfs/main_jadd.c
gfs2/tune/main.c
9 years
gfs2-utils: RHEL7 - libgfs2: Make find_good_lh and jhead_scan static
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=716ff320...
Commit: 716ff3208ab771a6f722d034b07e6ff380449dc9
Parent: e6340a86067173634df071ed35539b19b46408ef
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Sep 30 12:19:06 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:34 2015 +0100
libgfs2: Make find_good_lh and jhead_scan static
These functions were only being using by libgfs2 so remove them from
libgfs2.h and make them static.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 3 ---
gfs2/libgfs2/recovery.c | 6 ++----
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 45ec8b1..2907e8c 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -690,9 +690,6 @@ extern int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno,
extern void gfs2_revoke_clean(struct gfs2_sbd *sdp);
extern int get_log_header(struct gfs2_inode *ip, unsigned int blk,
struct gfs2_log_header *head);
-extern int find_good_lh(struct gfs2_inode *ip, unsigned int *blk,
- struct gfs2_log_header *head);
-extern int jhead_scan(struct gfs2_inode *ip, struct gfs2_log_header *head);
extern int gfs2_find_jhead(struct gfs2_inode *ip, struct gfs2_log_header *head);
extern int clean_journal(struct gfs2_inode *ip, struct gfs2_log_header *head);
diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
index 6ea828d..cad723f 100644
--- a/gfs2/libgfs2/recovery.c
+++ b/gfs2/libgfs2/recovery.c
@@ -91,9 +91,7 @@ int get_log_header(struct gfs2_inode *ip, unsigned int blk,
*
* Returns: errno
*/
-
-int find_good_lh(struct gfs2_inode *ip, unsigned int *blk,
- struct gfs2_log_header *head)
+static int find_good_lh(struct gfs2_inode *ip, unsigned int *blk, struct gfs2_log_header *head)
{
unsigned int orig_blk = *blk;
int error;
@@ -123,7 +121,7 @@ int find_good_lh(struct gfs2_inode *ip, unsigned int *blk,
* Returns: errno
*/
-int jhead_scan(struct gfs2_inode *ip, struct gfs2_log_header *head)
+static int jhead_scan(struct gfs2_inode *ip, struct gfs2_log_header *head)
{
unsigned int blk = head->lh_blkno;
uint32_t jd_blocks = ip->i_di.di_size / ip->i_sbd->sd_sb.sb_bsize;
9 years
gfs2-utils: RHEL7 - gfs2_edit: Add bounds checking for the journalN keyword
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=e6340a86...
Commit: e6340a86067173634df071ed35539b19b46408ef
Parent: 29ff6c3ce3212aae4bbbe35b6ebde27ad19a4378
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Oct 13 16:39:34 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:34 2015 +0100
gfs2_edit: Add bounds checking for the journalN keyword
Spotted by coverity: "Using tainted variable "journal_num + 2" as an
index to array "indirect->ii[0].dirent""
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/journal.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c
index 81d7a90..a2aeb2c 100644
--- a/gfs2/edit/journal.c
+++ b/gfs2/edit/journal.c
@@ -41,6 +41,9 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
char jbuf[sbd.bsize];
journal_num = atoi(journal + 7);
+ if (journal_num < 0)
+ return 0;
+
/* Figure out the block of the jindex file */
if (sbd.gfs1)
jindex_block = sbd1->sb_jindex_di.no_addr;
@@ -73,6 +76,8 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
} else {
struct gfs2_dinode jdi;
+ if (journal_num > indirect->ii[0].dirents - 2)
+ return 0;
jblock = indirect->ii[0].dirent[journal_num + 2].block;
j_bh = bread(&sbd, jblock);
gfs2_dinode_in(&jdi, j_bh);/* parse dinode to struct */
9 years
gfs2-utils: RHEL7 - gfs2_convert: Don't use a fixed sized buffer for device path
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=29ff6c3c...
Commit: 29ff6c3ce3212aae4bbbe35b6ebde27ad19a4378
Parent: 768b31bd776cbcf9156bcf0517f4665b13ae32b4
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Oct 13 16:10:18 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:34 2015 +0100
gfs2_convert: Don't use a fixed sized buffer for device path
Previously gfs2_convert only allowed for a 255-char device path. Remove
the fixed-size buffer and use the existing device pointer in the options
struct instead.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 42 ++++++++++++++++--------------------------
1 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index c0980bc..bb4e3a2 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -98,7 +98,6 @@ struct gfs2_options {
struct gfs_sb raw_gfs1_ondisk_sb;
struct gfs2_sbd sb2;
-char device[256];
struct inode_block dirs_to_fix; /* linked list of directories to fix */
struct inode_dir_block cdpns_to_fix; /* linked list of cdpn symlinks */
int seconds;
@@ -1544,15 +1543,15 @@ static int sanity_check(struct gfs2_sbd *sdp)
/* init - initialization code */
/* Returns: 0 on success, -1 on failure */
/* ------------------------------------------------------------------------- */
-static int init(struct gfs2_sbd *sbp)
+static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
{
struct gfs2_buffer_head *bh;
int rgcount;
struct gfs2_inum inum;
memset(sbp, 0, sizeof(struct gfs2_sbd));
- if ((sbp->device_fd = open(device, O_RDWR)) < 0) {
- perror(device);
+ if ((sbp->device_fd = open(opts->device, O_RDWR)) < 0) {
+ perror(opts->device);
exit(-1);
}
/* --------------------------------- */
@@ -1634,8 +1633,7 @@ static int init(struct gfs2_sbd *sbp)
sbp->sd_sb.sb_header.mh_type != GFS_METATYPE_SB ||
sbp->sd_sb.sb_header.mh_format != GFS_FORMAT_SB ||
sbp->sd_sb.sb_multihost_format != GFS_FORMAT_MULTI) {
- log_crit(_("Error: %s does not look like a gfs1 filesystem.\n"),
- device);
+ log_crit(_("Error: %s does not look like a gfs1 filesystem.\n"), opts->device);
close(sbp->device_fd);
exit(-1);
}
@@ -1733,7 +1731,6 @@ static void process_parameters(int argc, char **argv, struct gfs2_options *opts)
usage(argv[0]);
exit(0);
}
- memset(device, 0, sizeof(device));
while((c = getopt(argc, argv, "hnqvyV")) != -1) {
switch(c) {
@@ -1762,12 +1759,7 @@ static void process_parameters(int argc, char **argv, struct gfs2_options *opts)
}
}
if(argc > optind) {
- strcpy(device, argv[optind]);
- opts->device = device;
- if(!opts->device) {
- fprintf(stderr, _("No device specified. Please use '-h' for help\n"));
- exit(1);
- }
+ opts->device = argv[optind];
} else {
fprintf(stderr, _("No device specified. Please use '-h' for help\n"));
exit(1);
@@ -2174,7 +2166,7 @@ int main(int argc, char **argv)
version();
process_parameters(argc, argv, &opts);
- error = init(&sb2);
+ error = init(&sb2, &opts);
/*
* Check for some common fs errors
@@ -2183,7 +2175,7 @@ int main(int argc, char **argv)
if (sanity_check(&sb2)) {
log_crit(_("%s is not a clean gfs filesytem. Please use the"
" fsck.gfs2 utility to correct these errors and"
- " try again.\n"), device);
+ " try again.\n"), opts.device);
exit(0);
}
}
@@ -2192,8 +2184,8 @@ int main(int argc, char **argv)
/* ---------------------------------------------- */
if (!error) {
give_warning();
- if (!gfs2_query(&opts, device)) {
- log_crit(_("%s not converted.\n"), device);
+ if (!gfs2_query(&opts, opts.device)) {
+ log_crit(_("%s not converted.\n"), opts.device);
close(sb2.device_fd);
exit(0);
}
@@ -2207,8 +2199,7 @@ int main(int argc, char **argv)
error = convert_rgs(&sb2);
log_notice("\n");
if (error)
- log_crit(_("%s: Unable to convert resource groups.\n"),
- device);
+ log_crit(_("%s: Unable to convert resource groups.\n"), opts.device);
fsync(sb2.device_fd); /* write the buffers to disk */
}
/* ---------------------------------------------- */
@@ -2219,7 +2210,7 @@ int main(int argc, char **argv)
error = inode_renumber(&sb2, sb2.sd_sb.sb_root_dir.no_addr,
(osi_list_t *)&cdpns_to_fix);
if (error)
- log_crit(_("\n%s: Error renumbering inodes.\n"), device);
+ log_crit(_("\n%s: Error renumbering inodes.\n"), opts.device);
fsync(sb2.device_fd); /* write the buffers to disk */
}
/* ---------------------------------------------- */
@@ -2232,7 +2223,7 @@ int main(int argc, char **argv)
(unsigned long long)dirents_fixed);
fflush(stdout);
if (error)
- log_crit(_("\n%s: Error fixing directories.\n"), device);
+ log_crit(_("\n%s: Error fixing directories.\n"), opts.device);
}
/* ---------------------------------------------- */
/* Convert cdpn symlinks to empty dirs */
@@ -2243,7 +2234,7 @@ int main(int argc, char **argv)
(unsigned long long)cdpns_fixed);
fflush(stdout);
if (error)
- log_crit(_("\n%s: Error fixing cdpn symlinks.\n"), device);
+ log_crit(_("\n%s: Error fixing cdpn symlinks.\n"), opts.device);
}
/* ---------------------------------------------- */
/* Convert journal space to rg space */
@@ -2252,7 +2243,7 @@ int main(int argc, char **argv)
log_notice(_("\nConverting journals.\n"));
error = journ_space_to_rg(&sb2);
if (error)
- log_crit(_("%s: Error converting journal space.\n"), device);
+ log_crit(_("%s: Error converting journal space.\n"), opts.device);
fsync(sb2.device_fd); /* write the buffers to disk */
}
/* ---------------------------------------------- */
@@ -2364,10 +2355,9 @@ int main(int argc, char **argv)
error = fsync(sb2.device_fd);
if (error)
- perror(device);
+ perror(opts.device);
else
- log_notice(_("%s: filesystem converted successfully to gfs2.\n"),
- device);
+ log_notice(_("%s: filesystem converted successfully to gfs2.\n"), opts.device);
}
close(sb2.device_fd);
if (sd_jindex)
9 years
gfs2-utils: RHEL7 - gfs2-utils configure: Remove checks for non-existent -W flags
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=768b31bd...
Commit: 768b31bd776cbcf9156bcf0517f4665b13ae32b4
Parent: 941e00cac99042465e49512e641d60aee7924544
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Oct 10 20:58:35 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:34 2015 +0100
gfs2-utils configure: Remove checks for non-existent -W flags
checking whether gcc supports -Wunsigned-char... no
checking whether gcc supports -Wgnu89-inline... no
This has always been the case, as far as I can tell, and I can't find
any mention of a compiler which does support these flags. Remove the
checks for these flags from configure.ac.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2269aba..e70409c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -197,8 +197,6 @@ WARNLIST="
format-security
format-nonliteral
no-long-long
- unsigned-char
- gnu89-inline
no-strict-aliasing
"
9 years
gfs2-utils: RHEL7 - gfs2-utils configure: Fix exit with failure condition
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=941e00ca...
Commit: 941e00cac99042465e49512e641d60aee7924544
Parent: ced7d62fde2e84f1a5fa216b494f608beb42167d
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Oct 10 20:53:48 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Apr 1 16:51:34 2015 +0100
gfs2-utils configure: Fix exit with failure condition
When gcov is disabled, the test at the end of the configure script would
cause the script to exit with status 1 despite succeeding. Restructure
the test to make sure its exit status is consumed in an if statement.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index a978e52..2269aba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -234,5 +234,9 @@ AC_CONFIG_FILES([Makefile
AC_OUTPUT
-test x"$have_check" = "xyes" || AC_MSG_NOTICE([package 'check' not found; unit tests will not be built])
-test x"${enable_gcov}" = "xyes" && AC_MSG_NOTICE([code coverage enabled; optimization will be disabled])
+if test x"${have_check}" != "xyes"; then
+ AC_MSG_NOTICE([package 'check' not found; unit tests will not be built])
+fi
+if test x"${enable_gcov}" = "xyes"; then
+ AC_MSG_NOTICE([code coverage enabled; optimization will be disabled])
+fi
9 years