cluster: RHEL56 - gfs_fsck -q prints "Succeeded." a lot
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: c774ea0aabf408e80e1afd9f2caf40b4834c6a5e
Parent: b83b1ee7f3cf0cf04ed52932e5c1e75259b9ecd2
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Fri Mar 5 13:17:19 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Wed Apr 14 14:01:41 2010 -0500
gfs_fsck -q prints "Succeeded." a lot
This patch changes the "Succeeded" message in pass5 to be at
the correct "info" level from its original "err" level.
rhbz#567657
---
gfs/gfs_fsck/pass5.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gfs/gfs_fsck/pass5.c b/gfs/gfs_fsck/pass5.c
index 1b01d84..2cc6425 100644
--- a/gfs/gfs_fsck/pass5.c
+++ b/gfs/gfs_fsck/pass5.c
@@ -228,7 +228,7 @@ static int check_block_status(struct fsck_sb *sbp, char *buffer, unsigned int bu
block);
}
else {
- log_err("Succeeded.\n");
+ log_info("Succeeded.\n");
errors_corrected++;
}
}
14 years, 1 month
cluster: RHEL56 - GFS2: fsck.gfs2 segfault - osi_tree "each_safe" patch
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: b83b1ee7f3cf0cf04ed52932e5c1e75259b9ecd2
Parent: bbd213cf02b9f427342d75e4c05d4cf95d80d8ef
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Fri Apr 9 20:00:03 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500
GFS2: fsck.gfs2 segfault - osi_tree "each_safe" patch
There are a few places in fsck.gfs2 where each element of the
new rbtrees are processed. Some of those places delete
items from the rbtree, which means I need to use the equivalent
of osi_list_foreach_safe. In other words, I needed to prevent
rbtree deletes from interfering with the next() function.
The result was a segfault in fsck.gfs2 in a few places. This
patch implements the "safe" rbtree traversal and fixes the problem.
rhbz#455300
---
gfs2/fsck/link.c | 2 --
gfs2/fsck/pass1b.c | 10 ++++++----
gfs2/fsck/pass3.c | 5 +++--
gfs2/fsck/pass4.c | 5 +++--
4 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/gfs2/fsck/link.c b/gfs2/fsck/link.c
index a39db33..525836d 100644
--- a/gfs2/fsck/link.c
+++ b/gfs2/fsck/link.c
@@ -80,8 +80,6 @@ int decrement_link(uint64_t inode_no, uint64_t referenced_from,
ii = inodetree_find(inode_no);
/* If the list has entries, look for one that matches
* inode_no */
- log_err( _("Decrementing %"PRIu64" (0x%" PRIx64 ") to %d\n"),
- inode_no, inode_no, ii->counted_links);
if(ii) {
ii->counted_links--;
log_debug( _("Directory %lld (0x%llx) decremented counted "
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index e00294a..8b67573 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -184,12 +184,13 @@ static int find_dentry(struct gfs2_inode *ip, struct gfs2_dirent *de,
struct gfs2_buffer_head *bh, char *filename,
uint16_t *count, void *priv)
{
- struct osi_node *n;
+ struct osi_node *n, *next = NULL;
osi_list_t *tmp2;
struct duptree *b;
int found;
- for (n = osi_first(&dup_blocks); n; n = osi_next(n)) {
+ for (n = osi_first(&dup_blocks); n; n = next) {
+ next = osi_next(n);
b = (struct duptree *)n;
found = 0;
osi_list_foreach(tmp2, &b->ref_invinode_list) {
@@ -616,7 +617,7 @@ int pass1b(struct gfs2_sbd *sbp)
struct duptree *b;
uint64_t i;
uint8_t q;
- struct osi_node *n;
+ struct osi_node *n, *next = NULL;
int rc = FSCK_OK;
log_info( _("Looking for duplicate blocks...\n"));
@@ -666,7 +667,8 @@ int pass1b(struct gfs2_sbd *sbp)
* it later */
log_info( _("Handling duplicate blocks\n"));
out:
- for (n = osi_first(&dup_blocks); n; n = osi_next(n)) {
+ for (n = osi_first(&dup_blocks); n; n = next) {
+ next = osi_next(n);
b = (struct duptree *)n;
if (!skip_this_pass && !rc) /* no error & not asked to skip the rest */
handle_dup_blk(sbp, b);
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index b200d42..65736f1 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -185,7 +185,7 @@ static struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp,
*/
int pass3(struct gfs2_sbd *sbp)
{
- struct osi_node *tmp;
+ struct osi_node *tmp, *next = NULL;
struct dir_info *di, *tdi;
struct gfs2_inode *ip;
uint8_t q;
@@ -206,7 +206,8 @@ int pass3(struct gfs2_sbd *sbp)
* find a parent, put in lost+found.
*/
log_info( _("Checking directory linkage.\n"));
- for (tmp = osi_first(&dirtree); tmp; tmp = osi_next(tmp)) {
+ for (tmp = osi_first(&dirtree); tmp; tmp = next) {
+ next = osi_next(tmp);
di = (struct dir_info *)tmp;
while(!di->checked) {
/* FIXME: Change this so it returns success or
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index 43f12bc..a8d2533 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -53,7 +53,7 @@ static int fix_link_count(struct inode_info *ii, struct gfs2_inode *ip)
}
static int scan_inode_list(struct gfs2_sbd *sbp) {
- struct osi_node *tmp;
+ struct osi_node *tmp, *next = NULL;
struct inode_info *ii;
struct gfs2_inode *ip;
int lf_addition = 0;
@@ -61,9 +61,10 @@ static int scan_inode_list(struct gfs2_sbd *sbp) {
/* FIXME: should probably factor this out into a generic
* scanning fxn */
- for (tmp = osi_first(&inodetree); tmp; tmp = osi_next(tmp)) {
+ for (tmp = osi_first(&inodetree); tmp; tmp = next) {
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return 0;
+ next = osi_next(tmp);
if(!(ii = (struct inode_info *)tmp)) {
log_crit( _("osi_tree broken in scan_info_list!!\n"));
exit(FSCK_ERROR);
14 years, 1 month
cluster: RHEL56 - gfs2: fix regressions from performance fixes
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: bbd213cf02b9f427342d75e4c05d4cf95d80d8ef
Parent: 4c15e60d5a1750cf43316e8530727afbc63fe57c
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Thu Feb 25 13:27:22 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500
gfs2: fix regressions from performance fixes
This patch fixes regressions recently introduced by the performance
enhancements for fsck.gfs2 and libgfs2.
rhbz#455300
---
gfs2/edit/hexedit.c | 2 +-
gfs2/edit/savemeta.c | 1 +
gfs2/libgfs2/fs_ops.c | 12 ++++--------
gfs2/libgfs2/structures.c | 16 ++++++++++------
gfs2/mkfs/main_grow.c | 2 ++
gfs2/mkfs/main_mkfs.c | 1 +
gfs2/quota/gfs2_quota.h | 2 --
7 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 643fdb5..2394eac 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -2549,7 +2549,7 @@ static void process_field(const char *field, uint64_t *newval, int print_field)
struct gfs2_rgrp rg;
fblock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
- rbh = bread(&sbd, block);
+ rbh = bread(&sbd, fblock);
type = get_block_type(rbh);
switch (type) {
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 1b5c2c1..d47b283 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -290,6 +290,7 @@ static void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
if (height != hgt) { /* If not at max height */
nbh = bread(&sbd, indir_block);
osi_list_add_prev(&nbh->b_altlist, cur_list);
+ brelse(nbh);
}
} /* for all data on the indirect block */
}
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 4969ad5..aed34c6 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -674,14 +674,10 @@ struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn,
bmodified(ip->i_bh);
ip->i_di.di_size = (lbn + 1) << sdp->sd_sb.sb_bsize_shift;
}
- if (new)
- return bget(sdp, dbn);
- else {
- if (dbn == ip->i_di.di_num.no_addr)
- return ip->i_bh;
- else
- return bread(sdp, dbn);
- }
+ if (dbn == ip->i_di.di_num.no_addr)
+ return ip->i_bh;
+ else
+ return bread(sdp, dbn);
}
int gfs2_dirent_first(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 5e176a9..ea0ca6a 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -118,6 +118,7 @@ void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
if (!bh)
die("write_journal\n");
+ memset(bh->b_data, 0, sdp->bsize);
lh.lh_sequence = seq;
lh.lh_blkno = x;
gfs2_log_header_out(&lh, bh);
@@ -216,6 +217,8 @@ build_quota_change(struct gfs2_inode *per_node, unsigned int j)
struct gfs2_inode *ip;
unsigned int blocks = sdp->qcsize << (20 - sdp->sd_sb.sb_bsize_shift);
unsigned int x;
+ unsigned int hgt;
+ struct gfs2_buffer_head *bh;
memset(&mh, 0, sizeof(struct gfs2_meta_header));
mh.mh_magic = GFS2_MAGIC;
@@ -223,16 +226,18 @@ build_quota_change(struct gfs2_inode *per_node, unsigned int j)
mh.mh_format = GFS2_FORMAT_QC;
sprintf(name, "quota_change%u", j);
- ip = createi(per_node, name, S_IFREG | 0600,
- GFS2_DIF_SYSTEM);
+ ip = createi(per_node, name, S_IFREG | 0600, GFS2_DIF_SYSTEM);
+
+ hgt = calc_tree_height(ip, (blocks + 1) * sdp->bsize);
+ build_height(ip, hgt);
for (x = 0; x < blocks; x++) {
- struct gfs2_buffer_head *bh = get_file_buf(ip, ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift, FALSE);
+ bh = get_file_buf(ip, x, FALSE);
if (!bh)
die("build_quota_change\n");
+ memset(bh->b_data, 0, sdp->bsize);
gfs2_meta_header_out(&mh, bh);
-
brelse(bh);
}
@@ -313,8 +318,7 @@ build_rindex(struct gfs2_sbd *sdp)
ip->i_di.di_payload_format = GFS2_FORMAT_RI;
bmodified(ip->i_bh);
- for (head = &sdp->rglist, tmp = head->next;
- tmp != head;
+ for (head = &sdp->rglist, tmp = head->next; tmp != head;
tmp = tmp->next) {
rl = osi_list_entry(tmp, struct rgrp_list, list);
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index a8e2f66..a6fac0a 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -216,6 +216,8 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
gfs2_rindex_out(&rl->ri, bufptr);
bufptr += sizeof(struct gfs2_rindex);
}
+ gfs2_rgrp_free(&sdp->rglist);
+ fsync(sdp->device_fd);
if (!test) {
/* Now write the new RGs to the end of the rindex */
lseek(rindex_fd, 0, SEEK_END);
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 31ef735..3dc3337 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -505,6 +505,7 @@ main_mkfs(int argc, char *argv[])
inode_put(&sdp->md.inum);
inode_put(&sdp->md.statfs);
+ gfs2_rgrp_free(&sdp->rglist);
error = fsync(sdp->device_fd);
if (error)
die( _("can't fsync device (%d): %s\n"),
diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
index 064c813..e79757d 100644
--- a/gfs2/quota/gfs2_quota.h
+++ b/gfs2/quota/gfs2_quota.h
@@ -73,8 +73,6 @@ struct commandline {
};
typedef struct commandline commandline_t;
-extern char *prog_name;
-
/* main.c */
void do_get_super(int fd, struct gfs2_sb *sb);
14 years, 1 month
cluster: RHEL56 - GFS2: libgfs2: build_rgrps was not attaching bh's properly
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 4c15e60d5a1750cf43316e8530727afbc63fe57c
Parent: 7b9e48f534a1b3aa0ff2138b9038379bf3d33ab7
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Wed Feb 24 09:05:43 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500
GFS2: libgfs2: build_rgrps was not attaching bh's properly
Function build_rgrps, which is only used by mkfs.gfs2 was not
attaching buffers properly to the rgrps in memory. This patch
corrects the situation.
rhbz#455300
---
gfs2/libgfs2/fs_geometry.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c
index 28de184..105ce7b 100644
--- a/gfs2/libgfs2/fs_geometry.c
+++ b/gfs2/libgfs2/fs_geometry.c
@@ -190,10 +190,8 @@ void build_rgrps(struct gfs2_sbd *sdp, int do_write)
struct rgrp_list *rl;
uint32_t rgblocks, bitblocks;
struct gfs2_rindex *ri;
- struct gfs2_rgrp rg;
struct gfs2_meta_header mh;
unsigned int x;
- struct gfs2_buffer_head *bh;
mh.mh_magic = GFS2_MAGIC;
mh.mh_type = GFS2_METATYPE_RB;
@@ -214,20 +212,21 @@ void build_rgrps(struct gfs2_sbd *sdp, int do_write)
ri->ri_data = rgblocks;
ri->ri_bitbytes = rgblocks / GFS2_NBBY;
- memset(&rg, 0, sizeof(rg));
- rg.rg_header.mh_magic = GFS2_MAGIC;
- rg.rg_header.mh_type = GFS2_METATYPE_RG;
- rg.rg_header.mh_format = GFS2_FORMAT_RG;
- rg.rg_free = rgblocks;
+ memset(&rl->rg, 0, sizeof(rl->rg));
+ rl->rg.rg_header.mh_magic = GFS2_MAGIC;
+ rl->rg.rg_header.mh_type = GFS2_METATYPE_RG;
+ rl->rg.rg_header.mh_format = GFS2_FORMAT_RG;
+ rl->rg.rg_free = rgblocks;
+
+ gfs2_compute_bitstructs(sdp, rl);
if (do_write) {
for (x = 0; x < bitblocks; x++) {
- bh = bget(sdp, rl->start + x);
+ rl->bh[x] = bget(sdp, rl->start + x);
if (x)
- gfs2_meta_header_out(&mh, bh);
+ gfs2_meta_header_out(&mh, rl->bh[x]);
else
- gfs2_rgrp_out(&rg, bh);
- brelse(bh);
+ gfs2_rgrp_out(&rl->rg, rl->bh[x]);
}
}
14 years, 1 month
cluster: RHEL56 - GFS2: Dinode #33129 (0x8169) has bad height Found 1, Expected >= 2
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 7b9e48f534a1b3aa0ff2138b9038379bf3d33ab7
Parent: efc08c2e2456e59cc5098ec89071343f2d72757c
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Fri Feb 19 07:52:37 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500
GFS2: Dinode #33129 (0x8169) has bad height Found 1, Expected >= 2
Basically, commit 9b8c81d1 allowed gfs2 to have dinode
sizes (via truncate, etc.) that are bigger than the
metadata tree would suggest. Therefore, the check for
an invalid height size needed to be removed from pass1.
rhbz#455300
---
gfs2/fsck/initialize.c | 2 ++
gfs2/fsck/pass1.c | 19 -------------------
gfs2/fsck/util.c | 31 -------------------------------
3 files changed, 2 insertions(+), 50 deletions(-)
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 2687bdb..64685ed 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -228,6 +228,8 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
continue;
}
for (y = 0; y < GFS2_NBBY; y++) {
+ if (fsck_abort) /* if asked to abort */
+ return;
state = (*byte >>
(GFS2_BIT_SIZE * y)) & GFS2_BIT_MASK;
if (state == GFS2_BLKST_USED)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index cc3ca9f..0b8ca09 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1026,25 +1026,6 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
return -1;
}
- /* FIXME: fix height and depth here - wasn't implemented in
- * old fsck either, so no biggy... */
- if (ip->i_di.di_height < compute_height(sdp, ip->i_di.di_size)){
- log_warn( _("Dinode #%" PRIu64 " (0x%" PRIx64 ") has bad height "
- "Found %u, Expected >= %u\n"), ip->i_di.di_num.no_addr,
- ip->i_di.di_num.no_addr, ip->i_di.di_height,
- compute_height(sdp, ip->i_di.di_size));
- /* once implemented, remove continue statement */
- log_warn( _("Marking inode invalid\n"));
- if(gfs2_blockmap_set(bl, block, gfs2_meta_inval)) {
- stack;
- fsck_inode_put(&ip);
- return -1;
- }
- gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
- fsck_inode_put(&ip);
- return 0;
- }
-
if (S_ISDIR(ip->i_di.di_mode) &&
(ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
if (((1 << ip->i_di.di_depth) * sizeof(uint64_t)) != ip->i_di.di_size){
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index 3154979..924ef45 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -29,37 +29,6 @@
const char *reftypes[3] = {"data", "metadata", "extended attribute"};
-/**
- * compute_height
- * @sdp:
- * @sz:
- *
- */
-int compute_height(struct gfs2_sbd *sdp, uint64_t sz)
-{
- unsigned int height;
- uint64_t space, old_space;
- unsigned int bsize = sdp->sd_sb.sb_bsize;
-
- if (sz <= (bsize - sizeof(struct gfs2_dinode)))
- return 0;
-
- height = 1;
- space = sdp->sd_diptrs * bsize;
-
- while (sz > space) {
- old_space = space;
-
- height++;
- space *= sdp->sd_inptrs;
-
- if (space / sdp->sd_inptrs != old_space ||
- space % sdp->sd_inptrs != 0)
- break;
- }
- return height;
-}
-
void big_file_comfort(struct gfs2_inode *ip, uint64_t blks_checked)
{
static struct timeval tv;
14 years, 1 month
cluster: RHEL56 - Convert check_statfs function to the new rgrp method
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: efc08c2e2456e59cc5098ec89071343f2d72757c
Parent: 27ddb92542bfa62d94e7e2496e717f84aaef53f6
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Thu Feb 18 08:26:31 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500
Convert check_statfs function to the new rgrp method
The performance patches for bug #455300 attached buffer_head
structures to the rgrps, so the relatively new check_statfs
function needs to be adjusted to use this method.
rhbz#455300
---
gfs2/fsck/main.c | 18 +-----------------
1 files changed, 1 insertions(+), 17 deletions(-)
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index 1a06f53..ae8d6c0 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -268,7 +268,7 @@ static int check_system_inodes(struct gfs2_sbd *sdp)
return 0;
}
-void check_statfs(struct gfs2_sbd *sdp)
+static void check_statfs(struct gfs2_sbd *sdp)
{
osi_list_t *tmp;
struct rgrp_list *rgd;
@@ -276,7 +276,6 @@ void check_statfs(struct gfs2_sbd *sdp)
struct gfs2_statfs_change sc;
char buf[sizeof(struct gfs2_statfs_change)];
int count;
- struct gfs2_buffer_head **rgbh;
/* Read the current statfs values */
count = gfs2_readi(sdp->md.statfs, buf, 0,
@@ -292,24 +291,9 @@ void check_statfs(struct gfs2_sbd *sdp)
for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next) {
rgd = osi_list_entry(tmp, struct rgrp_list, list);
ri = &rgd->ri;
- if(!(rgbh = (struct gfs2_buffer_head **)
- malloc(rgd->ri.ri_length *
- sizeof(struct gfs2_buffer_head *)))) {
- log_err( _("Error: can't allocate memory to check statfs.\n"));
- return;
- }
- if(!memset(rgbh, 0, rgd->ri.ri_length *
- sizeof(struct gfs2_buffer_head *))) {
- free(rgbh);
- log_err( _("Error: can't allocate memory to check statfs.\n"));
- return;
- }
- gfs2_rgrp_read(sdp, rgd);
sdp->blks_total += ri->ri_data;
sdp->blks_alloced += (ri->ri_data - rgd->rg.rg_free);
sdp->dinodes_alloced += rgd->rg.rg_dinodes;
- gfs2_rgrp_relse(rgd);
- free(rgbh);
}
/* See if they match */
14 years, 1 month
cluster: RHEL56 - gfs2_edit savemeta: Don't release indirect buffers too soon
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 27ddb92542bfa62d94e7e2496e717f84aaef53f6
Parent: 1b06b8a4e4f9b36566b6ea15a094243ae06dc0e2
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed Feb 10 13:46:58 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500
gfs2_edit savemeta: Don't release indirect buffers too soon
This patch fixes a regression in the "gfs2_edit savemeta" command
whereby system files such as journals were not being saved.
The function that processes indirect block lists was releasing
buffers in a fashion that works okay with the old buf.c
assumptions but too soon for the new buf.c assumptions.
rhbz#455300
---
gfs2/edit/savemeta.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index b630280..1b5c2c1 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -289,9 +289,7 @@ static void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
}
if (height != hgt) { /* If not at max height */
nbh = bread(&sbd, indir_block);
- osi_list_add_prev(&nbh->b_altlist,
- cur_list);
- brelse(nbh);
+ osi_list_add_prev(&nbh->b_altlist, cur_list);
}
} /* for all data on the indirect block */
}
14 years, 1 month
cluster: RHEL56 - Fix white space errors
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 1b06b8a4e4f9b36566b6ea15a094243ae06dc0e2
Parent: 7ccf5c0c60ff29fc6e8a1ef0fea01d510f2df79b
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Tue Jan 26 14:11:52 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500
Fix white space errors
This patch cleans up some whitespace issues with the previous 57 patches.
rhbz#455300
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/fsck/lost_n_found.c | 2 +-
gfs2/fsck/metawalk.c | 4 ++--
gfs2/fsck/pass1.c | 4 ++--
gfs2/fsck/pass1b.c | 3 +--
gfs2/fsck/pass2.c | 2 +-
gfs2/fsck/util.c | 2 +-
gfs2/include/osi_tree.h | 4 ++--
gfs2/libgfs2/gfs2_log.c | 6 +++---
9 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index fac5fec..3a9905e 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -425,7 +425,7 @@ static int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip)
int error = 0, di_height;
struct blocklist blocks, *blk, *newblk;
struct metapath gfs2mp;
- struct gfs2_buffer_head *dibh = ip->i_bh;
+ struct gfs2_buffer_head *dibh = ip->i_bh;
/* if there are no indirect blocks to check */
if (ip->i_di.di_height <= 1)
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index ed12f13..7d65fe0 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -179,7 +179,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
reprocess_inode(lf_dip, "lost+found");
/* This inode is linked from lost+found */
- increment_link(ip->i_di.di_num.no_addr, lf_dip->i_di.di_num.no_addr,
+ increment_link(ip->i_di.di_num.no_addr, lf_dip->i_di.di_num.no_addr,
_("from lost+found"));
/* If it's a directory, lost+found is back-linked to it via .. */
if(S_ISDIR(ip->i_di.di_mode))
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 6939437..5bcfb02 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1232,8 +1232,8 @@ fail:
* This does not include "data" blocks that are really
* hash table blocks for directories.
*
- * @ip:
- *
+ * @ip:
+ *
* returns: +ENOENT if there are too many bad pointers
* -1 if a more serious error occurred.
* 0 if no errors occurred
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index f85b1a2..cc3ca9f 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -159,7 +159,7 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block,
log_err( _("Found duplicate block %llu (0x%llx) referenced "
"as metadata in indirect block for dinode "
"%llu (0x%llx) - was marked %d (%s)\n"),
- (unsigned long long)block,
+ (unsigned long long)block,
(unsigned long long)block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr, q,
@@ -222,7 +222,7 @@ static int undo_check_metalist(struct gfs2_inode *ip, uint64_t block,
log_err( _("Reversing duplicate status of block %llu (0x%llx) "
"referenced as metadata in indirect block for "
"dinode %llu (0x%llx)\n"),
- (unsigned long long)block,
+ (unsigned long long)block,
(unsigned long long)block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index af814ae..e00294a 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -549,7 +549,7 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct duptree *b)
log_inode_reference(b, tmp, 1);
osi_list_foreach(tmp, &b->ref_inode_list)
log_inode_reference(b, tmp, 0);
-
+
last_reference = clear_a_reference(sbp, b, &b->ref_invinode_list,
&dh, 1);
if (!last_reference)
@@ -606,7 +606,6 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct duptree *b)
log_debug( _("All duplicate references were resolved.\n"));
}
return 0;
-
}
/* Pass 1b handles finding the previous inode for a duplicate block
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index effbfa6..2068802 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -240,7 +240,7 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
log_err( _("Bad directory entry deleted.\n"));
return 1;
}
-
+
calculated_hash = gfs2_disk_hash(tmp_name, de->de_name_len);
if (de->de_hash != calculated_hash){
log_err( _("Dir entry with bad hash or name length\n"
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index a9dce7b..3154979 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -173,7 +173,7 @@ int fsck_query(const char *format, ...)
errors_corrected++;
ret = 1;
break;
- } else if (tolower(response) == 'n') {
+ } else if (tolower(response) == 'n') {
ret = 0;
break;
} else {
diff --git a/gfs2/include/osi_tree.h b/gfs2/include/osi_tree.h
index 4ffae94..f0d0768 100644
--- a/gfs2/include/osi_tree.h
+++ b/gfs2/include/osi_tree.h
@@ -329,7 +329,7 @@ static inline struct osi_node *osi_next(struct osi_node *node)
/* If we have a right-hand child, go down and then left as far
as we can. */
if (node->osi_right) {
- node = node->osi_right;
+ node = node->osi_right;
while (node->osi_left)
node=node->osi_left;
return node;
@@ -354,7 +354,7 @@ static inline struct osi_node *osi_prev(struct osi_node *node)
/* If we have a left-hand child, go down and then right as far
as we can. */
if (node->osi_left) {
- node = node->osi_left;
+ node = node->osi_left;
while (node->osi_right)
node=node->osi_right;
return node;
diff --git a/gfs2/libgfs2/gfs2_log.c b/gfs2/libgfs2/gfs2_log.c
index 73d059b..e8523cf 100644
--- a/gfs2/libgfs2/gfs2_log.c
+++ b/gfs2/libgfs2/gfs2_log.c
@@ -184,9 +184,9 @@ int gfs2_query(int *setonabort, struct gfs2_options *opts,
}
printf("Continuing.\n");
} else if(tolower(response) == 'y') {
- ret = 1;
- break;
- } else if (tolower(response) == 'n') {
+ ret = 1;
+ break;
+ } else if (tolower(response) == 'n') {
ret = 0;
break;
} else {
14 years, 1 month
cluster: RHEL56 - Fix error where write_journal return code should be ignored
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 7ccf5c0c60ff29fc6e8a1ef0fea01d510f2df79b
Parent: 20c699b363c8ddd38ad29c35a20b5978384645e6
Author: Bob Peterson <bob(a)krishna.(none)>
AuthorDate: Wed Feb 17 13:25:42 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500
Fix error where write_journal return code should be ignored
This patch ignores the return code from write_journal. The
function returns an int value upstream, but doesn't in RHEL5.x
so this fixes a compile error.
rhbz#455300
---
gfs2/fsck/fs_recovery.c | 6 +++---
gfs2/fsck/inode_hash.c | 1 +
gfs2/fsck/pass1b.c | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index d5ccb75..654556c 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -553,9 +553,9 @@ out:
log_info( _("jid=%u: Failed\n"), j);
reinit:
if (query( _("Do you want to clear the journal instead? (y/n)")))
- error = write_journal(sdp, sdp->md.journal[j], j,
- sdp->md.journal[j]->i_di.di_size /
- sdp->sd_sb.sb_bsize);
+ write_journal(sdp, sdp->md.journal[j], j,
+ sdp->md.journal[j]->i_di.di_size /
+ sdp->sd_sb.sb_bsize);
else
log_err( _("jid=%u: journal not cleared.\n"), j);
return error;
diff --git a/gfs2/fsck/inode_hash.c b/gfs2/fsck/inode_hash.c
index b23fe08..8086abb 100644
--- a/gfs2/fsck/inode_hash.c
+++ b/gfs2/fsck/inode_hash.c
@@ -11,6 +11,7 @@
*******************************************************************************
******************************************************************************/
+#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <libintl.h>
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 5ad1e08..af814ae 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -13,6 +13,7 @@
#include <inttypes.h>
#include <linux_endian.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
14 years, 1 month
cluster: RHEL56 - fsck.gfs2: If journal replay fails, give option to reinitialize journal
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 20c699b363c8ddd38ad29c35a20b5978384645e6
Parent: 97f9ce088161a48df490b304c1866aa4a0694d33
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Mon Jan 25 17:07:34 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 9 23:45:34 2010 -0500
fsck.gfs2: If journal replay fails, give option to reinitialize journal
When fsck.gfs2 finds a dirty journal, it tries (with permission) to
replay the journal. However, if replaying the journal fails, the
user is left with no recourse. Their file system is now useless.
This patch gives them the option to reinitialize the journal that
failed, thereby allowing them the ability to mount it again.
rhbz#455300
---
gfs2/fsck/fs_recovery.c | 67 +++++++++++++++++++++++++---------------------
1 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index ca2ee52..d5ccb75 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -517,42 +517,47 @@ static int gfs2_recover_journal(struct gfs2_inode *ip, int j, int preen,
error = FSCK_ERROR;
goto out;
}
- if (query( _("\nJournal #%d (\"journal%d\") is dirty. Okay to "
- "replay it? (y/n)"), j+1, j)) {
- log_info( _("jid=%u: Replaying journal...\n"), j);
-
- sd_found_jblocks = sd_replayed_jblocks = 0;
- sd_found_metablocks = sd_replayed_metablocks = 0;
- sd_found_revokes = 0;
- sd_replay_tail = head.lh_tail;
- for (pass = 0; pass < 2; pass++) {
- error = foreach_descriptor(ip, head.lh_tail,
- head.lh_blkno, pass);
- if (error)
- goto out;
- }
- log_info( _("jid=%u: Found %u revoke tags\n"), j,
- sd_found_revokes);
- gfs2_revoke_clean(sdp);
- error = clean_journal(ip, &head);
+ if (!query( _("\nJournal #%d (\"journal%d\") is dirty. Okay to "
+ "replay it? (y/n)"), j+1, j))
+ goto reinit;
+
+ log_info( _("jid=%u: Replaying journal...\n"), j);
+
+ sd_found_jblocks = sd_replayed_jblocks = 0;
+ sd_found_metablocks = sd_replayed_metablocks = 0;
+ sd_found_revokes = 0;
+ sd_replay_tail = head.lh_tail;
+ for (pass = 0; pass < 2; pass++) {
+ error = foreach_descriptor(ip, head.lh_tail,
+ head.lh_blkno, pass);
if (error)
goto out;
- log_err( _("jid=%u: Replayed %u of %u journaled data blocks\n"),
- j, sd_replayed_jblocks, sd_found_jblocks);
- log_err( _("jid=%u: Replayed %u of %u metadata blocks\n"),
- j, sd_replayed_metablocks, sd_found_metablocks);
- } else {
- if (query( _("Do you want to clear the dirty journal instead? (y/n)"))) {
- write_journal(sdp, sdp->md.journal[j], j,
- sdp->md.journal[j]->i_di.di_size /
- sdp->sd_sb.sb_bsize);
-
- } else
- log_err( _("jid=%u: Dirty journal not replayed or cleared.\n"), j);
}
+ log_info( _("jid=%u: Found %u revoke tags\n"), j, sd_found_revokes);
+ gfs2_revoke_clean(sdp);
+ error = clean_journal(ip, &head);
+ if (error)
+ goto out;
+ log_err( _("jid=%u: Replayed %u of %u journaled data blocks\n"),
+ j, sd_replayed_jblocks, sd_found_jblocks);
+ log_err( _("jid=%u: Replayed %u of %u metadata blocks\n"),
+ j, sd_replayed_metablocks, sd_found_metablocks);
+ /* Check for errors and give them the option to reinitialize the
+ journal. */
out:
- log_info( _("jid=%u: %s\n"), j, (error) ? _("Failed") : _("Done"));
+ if (!error) {
+ log_info( _("jid=%u: Done\n"), j);
+ return 0;
+ }
+ log_info( _("jid=%u: Failed\n"), j);
+reinit:
+ if (query( _("Do you want to clear the journal instead? (y/n)")))
+ error = write_journal(sdp, sdp->md.journal[j], j,
+ sdp->md.journal[j]->i_di.di_size /
+ sdp->sd_sb.sb_bsize);
+ else
+ log_err( _("jid=%u: journal not cleared.\n"), j);
return error;
}
14 years, 1 month