Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdif…
Commit: f910f288e063ccb64df90c8dff371bffdd4a8620
Parent: ef9c2102d49a848f69edb8f7bd7605bf317b808c
Author: Steven Whitehouse <swhiteho(a)redhat.com>
AuthorDate: Wed Nov 30 13:19:33 2011 +0000
Committer: Steven Whitehouse <swhiteho(a)redhat.com>
CommitterDate: Wed Nov 30 13:19:33 2011 +0000
libgfs2: Clean up sb read/check functions
There is no need to specify in advance whether we want to accept
gfs1 format super blocks or not. We can simply return that info
and let the caller decide if gfs1 format is acceptable or not.
We can also remove the message regarding the magic number of the
superblock, since the caller prints out a message anyway if
the check fails.
That removes some more of the log_ messages from libgfs2 as a
result.
Signed-off-by: Steven Whitehouse <swhiteho(a)redhat.com>
---
gfs2/edit/savemeta.c | 4 ++--
gfs2/fsck/initialize.c | 4 ++--
gfs2/libgfs2/libgfs2.h | 4 ++--
gfs2/libgfs2/super.c | 23 ++++++-----------------
gfs2/mkfs/main_grow.c | 6 ++++--
5 files changed, 16 insertions(+), 25 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 31af23d..9d790fe 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -670,7 +670,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
fprintf(stderr, "Bad constants (1)\n");
exit(-1);
}
- ret = read_sb(&sbd, 1);
+ ret = read_sb(&sbd);
if (ret < 0) {
slow = TRUE;
sbd.gfs1 = 0;
@@ -911,7 +911,7 @@ static int restore_data(int fd, gzFile *gzin_fd, int printblocksonly,
memcpy(&bufsb, savedata->buf, sizeof(bufsb));
gfs2_sb_in(&sbd.sd_sb, &dummy_bh);
sbd1 = (struct gfs_sb *)&sbd.sd_sb;
- ret = check_sb(&sbd.sd_sb, 1);
+ ret = check_sb(&sbd.sd_sb);
if (ret < 0) {
fprintf(stderr,"Error: Invalid superblock data.\n");
return -1;
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index ba0df41..132d65a 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -1227,12 +1227,12 @@ static int fill_super_block(struct gfs2_sbd *sdp)
log_crit(_("Bad constants (1)\n"));
exit(FSCK_ERROR);
}
- ret = read_sb(sdp, 1);
+ ret = read_sb(sdp);
if (ret < 0) {
if (sb_repair(sdp) != 0)
return -1; /* unrepairable, so exit */
/* Now that we've tried to repair it, re-read it. */
- ret = read_sb(sdp, 1);
+ ret = read_sb(sdp);
if (ret < 0)
return -1;
}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 04169bf..b24e555 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -722,8 +722,8 @@ extern int gfs2_next_rg_freemeta(struct rgrp_tree *rgd, uint64_t *block,
int first);
/* super.c */
-extern int check_sb(struct gfs2_sb *sb, int allow_gfs);
-extern int read_sb(struct gfs2_sbd *sdp, int allow_gfs);
+extern int check_sb(struct gfs2_sb *sb);
+extern int read_sb(struct gfs2_sbd *sdp);
extern int rindex_read(struct gfs2_sbd *sdp, int fd, int *count1, int *sane);
extern int ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount, int *sane);
extern int write_sb(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
index 2f544ab..c9a9ad3 100644
--- a/gfs2/libgfs2/super.c
+++ b/gfs2/libgfs2/super.c
@@ -13,7 +13,6 @@
/**
* check_sb - Check superblock
- * @sdp: the filesystem
* @sb: The superblock
*
* Checks the version code of the FS is one that we understand how to
@@ -22,25 +21,17 @@
*
* Returns: -1 on failure, 1 if this is gfs (gfs1), 2 if this is gfs2
*/
-int check_sb(struct gfs2_sb *sb, int allow_gfs)
+int check_sb(struct gfs2_sb *sb)
{
if (sb->sb_header.mh_magic != GFS2_MAGIC ||
sb->sb_header.mh_type != GFS2_METATYPE_SB) {
- log_crit("Either the super block is corrupted, or this "
- "is not a GFS2 filesystem\n");
- log_crit("Header magic: %X Header Type: %X\n",
- sb->sb_header.mh_magic,
- sb->sb_header.mh_type);
- return -EINVAL;
+ errno = -EIO;
+ return -1;
}
if (sb->sb_fs_format == GFS_FORMAT_FS &&
sb->sb_header.mh_format == GFS_FORMAT_SB &&
sb->sb_multihost_format == GFS_FORMAT_MULTI) {
- if (allow_gfs)
- return 1;
-
- log_crit("Old gfs1 file system detected.\n");
- return -EINVAL;
+ return 1;
}
return 2;
}
@@ -54,12 +45,10 @@ int check_sb(struct gfs2_sb *sb, int allow_gfs)
* initializes various constants maintained in the super
* block
*
- * allow_gfs - passed in as 1 if we're allowed to accept gfs1 file systems
- *
* Returns: 0 on success, -1 on failure
* sdp->gfs1 will be set if this is gfs (gfs1)
*/
-int read_sb(struct gfs2_sbd *sdp, int allow_gfs)
+int read_sb(struct gfs2_sbd *sdp)
{
struct gfs2_buffer_head *bh;
uint64_t space = 0;
@@ -70,7 +59,7 @@ int read_sb(struct gfs2_sbd *sdp, int allow_gfs)
gfs2_sb_in(&sdp->sd_sb, bh);
brelse(bh);
- ret = check_sb(&sdp->sd_sb, allow_gfs);
+ ret = check_sb(&sdp->sd_sb);
if (ret < 0)
return ret;
if (ret == 1)
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 1dc911a..5ed5a2d 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -358,9 +358,11 @@ main_grow(int argc, char *argv[])
perror(_("Bad constants (1)"));
exit(EXIT_FAILURE);
}
- if (read_sb(sdp, 0) < 0)
+ if (read_sb(sdp) < 0)
die( _("gfs: Error reading superblock.\n"));
-
+ if (sdp->gfs1) {
+ die( _("cannot grow gfs1 filesystem\n"));
+ }
if (fix_device_geometry(sdp)) {
fprintf(stderr, _("Device is too small (%llu bytes)\n"),
(unsigned long long)sdp->device.length << GFS2_BASIC_BLOCK_SHIFT);
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c3…
Commit: c39f49052a97fe2bdd5f46c29409676bd1783ed9
Parent: 707e2c72c21ab0b90ad04a32cb40114dcd0cc012
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Mon Nov 28 10:47:56 2011 +0100
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Mon Nov 28 10:47:56 2011 +0100
config: make altname validation position indipendent
Resolves: rhbz#740552
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
config/tools/xml/cluster.rng.in.head | 55 +++++++++++++++++++---------------
1 files changed, 31 insertions(+), 24 deletions(-)
diff --git a/config/tools/xml/cluster.rng.in.head b/config/tools/xml/cluster.rng.in.head
index e6e4633..11d5052 100644
--- a/config/tools/xml/cluster.rng.in.head
+++ b/config/tools/xml/cluster.rng.in.head
@@ -785,32 +785,11 @@ To validate your cluster.conf against this schema, run:
dlm_controld(8)"/>
</optional>
- <optional>
- <element name="altname" rha:description="Defines a second network
- interface to use for corosync redundant ring mode. cman(5)">
-
- <attribute name="name" rha:description="A second hostname or IP
- address of the node. cman(5)"/>
-
- <optional>
- <attribute name="port" rha:description="The network port to use
- on the second interface. cman(5)"/>
- </optional>
-
- <optional>
- <attribute name="mcast" rha:description="The multicast address
- to use on the second interface. cman(5)"/>
- </optional>
-
- <optional>
- <attribute name="ttl" rha:description="The multicast TTL
- to use on the second interface. cman(5)"/>
- </optional>
- </element>
- </optional>
-
<interleave>
<optional>
+ <ref name="ALTNAME"/>
+ </optional>
+ <optional>
<ref name="FENCE"/>
</optional>
<optional>
@@ -1034,6 +1013,34 @@ To validate your cluster.conf against this schema, run:
</element> <!-- cluster end -->
</start>
+<!-- begin node altname definitions -->
+
+ <define name="ALTNAME">
+ <element name="altname" rha:description="Defines a second network
+ interface to use for corosync redundant ring mode. cman(5)">
+
+ <attribute name="name" rha:description="A second hostname or IP
+ address of the node. cman(5)"/>
+
+ <optional>
+ <attribute name="port" rha:description="The network port to use
+ on the second interface. cman(5)"/>
+ </optional>
+
+ <optional>
+ <attribute name="mcast" rha:description="The multicast address
+ to use on the second interface. cman(5)"/>
+ </optional>
+
+ <optional>
+ <attribute name="ttl" rha:description="The multicast TTL
+ to use on the second interface. cman(5)"/>
+ </optional>
+ </element>
+ </define>
+
+<!-- end node altname definitions -->
+
<!-- begin node fence definitions -->
<define name="FENCE">