Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=8c7487c31e4fc…
Commit: 8c7487c31e4fc38cf061596c7444034bac423b2a
Parent: 5febedd2563c0e4958b0f8cde7b95d0a42c44f90
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Aug 9 11:38:18 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 5 06:25:00 2013 -0700
fsck.gfs2: Shorten output
This patch shortens some of the output of fsck.gfs2, thereby making
the output files smaller and more manageable.
rhbz#877150
---
gfs2/fsck/lost_n_found.c | 6 +++---
gfs2/fsck/metawalk.c | 7 ++++---
gfs2/fsck/pass5.c | 13 +++++++------
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index 627f94c..fd3b689 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -79,8 +79,8 @@ static void add_dotdot(struct gfs2_inode *ip)
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)di->dotdot_parent);
else
- log_debug(_("Couldn't find a valid \"..\" entry "
- "for orphan directory %lld (0x%llx)\n"),
+ log_debug(_("Couldn't find directory %lld (0x%llx) "
+ "in directory tree.\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
}
@@ -212,7 +212,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
incr_link_count(lf_dip->i_di.di_num.no_addr,
ip->i_di.di_mode, _("to lost+found"));
- log_notice( _("Added inode #%llu (0x%llx) to lost+found dir\n"),
+ log_notice( _("Added inode #%llu (0x%llx) to lost+found\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
gfs2_dinode_out(&lf_dip->i_di, lf_dip->i_bh);
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 7b20ef7..c094e70 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -59,12 +59,13 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, uint64_t blk,
const char *allocdesc[] = {"free space", "data", "unlinked",
"inode", "reserved"};
- log_err( _("Block %llu (0x%llx) seems to be %s, but is "
- "marked as %s in the bitmap.\n"),
+ /* Keep these messages as short as possible, or the output
+ gets to be huge and unmanageable. */
+ log_err( _("Block %llu (0x%llx) was '%s', should be %s.\n"),
(unsigned long long)blk, (unsigned long long)blk,
allocdesc[new_bitmap_state],
allocdesc[old_bitmap_state]);
- if (query( _("Okay to fix the bitmap? (y/n)"))) {
+ if (query( _("Fix the bitmap? (y/n)"))) {
/* If the new bitmap state is free (and therefore the
old state was not) we have to add to the free
space in the rgrp. If the old bitmap state was
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index 712cccc..95efd9f 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -92,8 +92,8 @@ static int check_block_status(struct gfs2_sbd *sdp, char *buffer, unsigned int b
So we ignore it. */
if (rg_status == GFS2_BLKST_UNLINKED &&
block_status == GFS2_BLKST_FREE) {
- log_err( _("Unlinked inode block found at "
- "block %llu (0x%llx).\n"),
+ log_err( _("Unlinked inode found at block %llu "
+ "(0x%llx).\n"),
(unsigned long long)block,
(unsigned long long)block);
if (query(_("Do you want to fix the bitmap? (y/n) "))) {
@@ -122,16 +122,17 @@ static int check_block_status(struct gfs2_sbd *sdp, char *buffer, unsigned int b
log_err( _("Ondisk status is %u (%s) but FSCK thinks it should be "),
rg_status, blockstatus[rg_status]);
log_err("%u (%s)\n", block_status, blockstatus[block_status]);
- log_err( _("Metadata type is %u (%s)\n"), q,
- block_type_string(q));
+ if (q) /* Don't print redundant "free" */
+ log_err( _("Metadata type is %u (%s)\n"), q,
+ block_type_string(q));
if (query(_("Fix bitmap for block %llu (0x%llx) ? (y/n) "),
(unsigned long long)block,
(unsigned long long)block)) {
if (gfs2_set_bitmap(sdp, block, block_status))
- log_err( _("Failed.\n"));
+ log_err( _("Repair failed.\n"));
else
- log_err( _("Succeeded.\n"));
+ log_err( _("Fixed.\n"));
} else
log_err( _("Bitmap at block %"PRIu64" (0x%" PRIx64
") left inconsistent\n"), block, block);
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=f4de877fc268b…
Commit: f4de877fc268b6915c92653230a279e60dfd560c
Parent: 7409a612d3dcca9b4e24ab32c07e2f2e6ffeb7a3
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Aug 9 09:23:05 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 5 06:25:00 2013 -0700
fsck.gfs2: fsck.gfs2: Move check_num_ptrs from metawalk to pass1
This patch moves function check_num_ptrs from metawalk.c to pass1.c
and also its helper function fix_leaf_pointers. This function checks
that the number of pointers in a leaf block is a factor of 2, and sane.
This should only happen once, when leaf blocks are initially checked.
Previously it was wasting a lot of time doing this check from every pass.
rhbz#877150
Conflicts:
gfs2/fsck/metawalk.h
gfs2/fsck/pass1.c
---
gfs2/fsck/metawalk.c | 129 +++-------------------------------------------
gfs2/fsck/metawalk.h | 4 ++
gfs2/fsck/pass1.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 150 insertions(+), 124 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 729a559..ae59121 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -478,123 +478,6 @@ static void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no,
*leaf_no = old_leaf;
}
-/*
- * fix_leaf_pointers - fix a directory dinode that has a number of pointers
- * that is not a multiple of 2.
- * dip - the directory inode having the problem
- * lindex - the index of the leaf right after the problem (need to back up)
- * cur_numleafs - current (incorrect) number of instances of the leaf block
- * correct_numleafs - the correct number instances of the leaf block
- */
-static int fix_leaf_pointers(struct gfs2_inode *dip, int *lindex,
- int cur_numleafs, int correct_numleafs)
-{
- int count;
- char *ptrbuf;
- int start_lindex = *lindex - cur_numleafs; /* start of bad ptrs */
- int tot_num_ptrs = (1 << dip->i_di.di_depth) - start_lindex;
- int bufsize = tot_num_ptrs * sizeof(uint64_t);
- int off_by = cur_numleafs - correct_numleafs;
-
- ptrbuf = malloc(bufsize);
- if (!ptrbuf) {
- log_err( _("Error: Cannot allocate memory to fix the leaf "
- "pointers.\n"));
- return -1;
- }
- /* Read all the pointers, starting with the first bad one */
- count = gfs2_readi(dip, ptrbuf, start_lindex * sizeof(uint64_t),
- bufsize);
- if (count != bufsize) {
- log_err( _("Error: bad read while fixing leaf pointers.\n"));
- free(ptrbuf);
- return -1;
- }
-
- bufsize -= off_by * sizeof(uint64_t); /* We need to write fewer */
- /* Write the same pointers, but offset them so they fit within the
- smaller factor of 2. So if we have 12 pointers, write out only
- the last 8 of them. If we have 7, write the last 4, etc.
- We need to write these starting at the current lindex and adjust
- lindex accordingly. */
- count = gfs2_writei(dip, ptrbuf + (off_by * sizeof(uint64_t)),
- start_lindex * sizeof(uint64_t), bufsize);
- if (count != bufsize) {
- log_err( _("Error: bad read while fixing leaf pointers.\n"));
- free(ptrbuf);
- return -1;
- }
- /* Now zero out the hole left at the end */
- memset(ptrbuf, 0, off_by * sizeof(uint64_t));
- gfs2_writei(dip, ptrbuf, (start_lindex * sizeof(uint64_t)) +
- bufsize, off_by * sizeof(uint64_t));
- free(ptrbuf);
- *lindex -= off_by; /* adjust leaf index to account for the change */
- return 0;
-}
-
-/* check_num_ptrs - check a previously processed leaf's pointer count */
-static int check_num_ptrs(struct gfs2_inode *ip, uint64_t old_leaf,
- int *ref_count, int *exp_count, int *lindex,
- struct gfs2_leaf *oldleaf)
-{
- int factor = 0, divisor = *ref_count, multiple = 1, error = 0;
- struct gfs2_buffer_head *lbh;
-
- /* Check to see if the number of pointers we found is a power of 2.
- It needs to be and if it's not we need to fix it.*/
- while (divisor > 1) {
- factor++;
- divisor /= 2;
- multiple = multiple << 1;
- }
- if (*ref_count != multiple) {
- log_err( _("Directory #%llu (0x%llx) has an "
- "invalid number of pointers to "
- "leaf #%llu (0x%llx)\n\tFound: %u, "
- "which is not a factor of 2.\n"),
- (unsigned long long)ip->i_di.di_num.no_addr,
- (unsigned long long)ip->i_di.di_num.no_addr,
- (unsigned long long)old_leaf,
- (unsigned long long)old_leaf, *ref_count);
- if (!query( _("Attempt to fix it? (y/n) "))) {
- log_err( _("Directory inode was not fixed.\n"));
- return 1;
- }
- error = fix_leaf_pointers(ip, lindex, *ref_count, multiple);
- if (error)
- return error;
- *ref_count = multiple;
- log_err( _("Directory inode was fixed.\n"));
- }
- /* Check to see if the counted number of leaf pointers is what we
- expect. */
- if (*ref_count != *exp_count) {
- log_err( _("Directory #%llu (0x%llx) has an "
- "incorrect number of pointers to "
- "leaf #%llu (0x%llx)\n\tFound: "
- "%u, Expected: %u\n"),
- (unsigned long long)ip->i_di.di_num.no_addr,
- (unsigned long long)ip->i_di.di_num.no_addr,
- (unsigned long long)old_leaf,
- (unsigned long long)old_leaf, *ref_count, *exp_count);
- if (!query( _("Attempt to fix it? (y/n) "))) {
- log_err( _("Directory leaf was not fixed.\n"));
- return 1;
- }
- lbh = bread(ip->i_sbd, old_leaf);
- gfs2_leaf_in(oldleaf, lbh);
- log_err( _("Leaf depth was %d, changed to %d\n"),
- oldleaf->lf_depth, ip->i_di.di_depth - factor);
- oldleaf->lf_depth = ip->i_di.di_depth - factor;
- gfs2_leaf_out(oldleaf, lbh);
- brelse(lbh);
- *exp_count = *ref_count;
- log_err( _("Directory leaf was fixed.\n"));
- }
- return 0;
-}
-
/* Checks exhash directory entries */
static int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass)
{
@@ -653,10 +536,14 @@ static int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass)
}
do {
- if (!valid_block(ip->i_sbd, old_leaf) == 0) {
- error = check_num_ptrs(ip, old_leaf,
- &ref_count, &exp_count,
- &lindex, &oldleaf);
+ if (fsck_abort)
+ return 0;
+ if (pass->check_num_ptrs &&
+ valid_block(ip->i_sbd, old_leaf)) {
+ error = pass->check_num_ptrs(ip, old_leaf,
+ &ref_count,
+ &lindex,
+ &oldleaf);
if (error)
return error;
}
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index 2fbc636..72ea672 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -100,6 +100,10 @@ struct metawalk_fxns {
void *private);
int (*finish_eattr_indir) (struct gfs2_inode *ip, int leaf_pointers,
int leaf_pointer_errors, void *private);
+ void (*big_file_msg) (struct gfs2_inode *ip, uint64_t blks_checked);
+ int (*check_num_ptrs) (struct gfs2_inode *ip, uint64_t leafno,
+ int *ref_count, int *lindex,
+ struct gfs2_leaf *leaf);
};
#endif /* _METAWALK_H */
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 9aac8fb..c7b24a7 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -47,7 +47,7 @@ struct block_count {
uint64_t ea_count;
};
-static int leaf(struct gfs2_inode *ip, uint64_t block, void *private);
+static int check_leaf(struct gfs2_inode *ip, uint64_t block, void *private);
static int check_metalist(struct gfs2_inode *ip, uint64_t block,
struct gfs2_buffer_head **bh, int h, void *private);
static int undo_check_metalist(struct gfs2_inode *ip, uint64_t block,
@@ -72,6 +72,8 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr,
struct gfs2_ea_header *ea_hdr,
struct gfs2_ea_header *ea_hdr_prev,
void *private);
+static int check_num_ptrs(struct gfs2_inode *ip, uint64_t leafno,
+ int *ref_count, int *lindex, struct gfs2_leaf *leaf);
static int finish_eattr_indir(struct gfs2_inode *ip, int leaf_pointers,
int leaf_pointer_errors, void *private);
static int invalidate_metadata(struct gfs2_inode *ip, uint64_t block,
@@ -92,7 +94,7 @@ static int handle_ip(struct gfs2_sbd *sdp, struct gfs2_inode *ip);
struct metawalk_fxns pass1_fxns = {
.private = NULL,
- .check_leaf = leaf,
+ .check_leaf = check_leaf,
.check_metalist = check_metalist,
.check_data = check_data,
.check_eattr_indir = check_eattr_indir,
@@ -101,6 +103,8 @@ struct metawalk_fxns pass1_fxns = {
.check_eattr_entry = check_eattr_entries,
.check_eattr_extentry = check_extended_leaf_eattr,
.finish_eattr_indir = finish_eattr_indir,
+ .big_file_msg = big_file_comfort,
+ .check_num_ptrs = check_num_ptrs,
};
struct metawalk_fxns undo_fxns = {
@@ -211,7 +215,138 @@ struct metawalk_fxns sysdir_fxns = {
.check_dentry = resuscitate_dentry,
};
-static int leaf(struct gfs2_inode *ip, uint64_t block, void *private)
+/*
+ * fix_leaf_pointers - fix a directory dinode that has a number of pointers
+ * that is not a multiple of 2.
+ * dip - the directory inode having the problem
+ * lindex - the index of the leaf right after the problem (need to back up)
+ * cur_numleafs - current (incorrect) number of instances of the leaf block
+ * correct_numleafs - the correct number instances of the leaf block
+ */
+static int fix_leaf_pointers(struct gfs2_inode *dip, int *lindex,
+ int cur_numleafs, int correct_numleafs)
+{
+ int count;
+ char *ptrbuf;
+ int start_lindex = *lindex - cur_numleafs; /* start of bad ptrs */
+ int tot_num_ptrs = (1 << dip->i_di.di_depth) - start_lindex;
+ int bufsize = tot_num_ptrs * sizeof(uint64_t);
+ int off_by = cur_numleafs - correct_numleafs;
+
+ ptrbuf = malloc(bufsize);
+ if (!ptrbuf) {
+ log_err( _("Error: Cannot allocate memory to fix the leaf "
+ "pointers.\n"));
+ return -1;
+ }
+ /* Read all the pointers, starting with the first bad one */
+ count = gfs2_readi(dip, ptrbuf, start_lindex * sizeof(uint64_t),
+ bufsize);
+ if (count != bufsize) {
+ log_err( _("Error: bad read while fixing leaf pointers.\n"));
+ free(ptrbuf);
+ return -1;
+ }
+
+ bufsize -= off_by * sizeof(uint64_t); /* We need to write fewer */
+ /* Write the same pointers, but offset them so they fit within the
+ smaller factor of 2. So if we have 12 pointers, write out only
+ the last 8 of them. If we have 7, write the last 4, etc.
+ We need to write these starting at the current lindex and adjust
+ lindex accordingly. */
+ count = gfs2_writei(dip, ptrbuf + (off_by * sizeof(uint64_t)),
+ start_lindex * sizeof(uint64_t), bufsize);
+ if (count != bufsize) {
+ log_err( _("Error: bad read while fixing leaf pointers.\n"));
+ free(ptrbuf);
+ return -1;
+ }
+ /* Now zero out the hole left at the end */
+ memset(ptrbuf, 0, off_by * sizeof(uint64_t));
+ gfs2_writei(dip, ptrbuf, (start_lindex * sizeof(uint64_t)) +
+ bufsize, off_by * sizeof(uint64_t));
+ free(ptrbuf);
+ *lindex -= off_by; /* adjust leaf index to account for the change */
+ return 0;
+}
+
+/**
+ * check_num_ptrs - check a previously processed leaf's pointer count in the
+ * hash table.
+ *
+ * The number of pointers in a directory hash table that point to any given
+ * leaf block should always be a factor of two. The difference between the
+ * leaf block's depth and the dinode's di_depth gives us the factor.
+ * This function makes sure the leaf follows the rules properly.
+ *
+ * ip - pointer to the in-core inode structure
+ * leafno - the leaf number we're operating on
+ * ref_count - the number of pointers to this leaf we actually counted.
+ * exp_count - the number of pointers to this leaf we expect based on
+ * ip depth minus leaf depth.
+ * lindex - leaf index number
+ * leaf - the leaf structure for the leaf block to check
+ */
+static int check_num_ptrs(struct gfs2_inode *ip, uint64_t leafno,
+ int *ref_count, int *lindex, struct gfs2_leaf *leaf)
+{
+ int factor = 0, divisor = *ref_count, multiple = 1, error = 0;
+ struct gfs2_buffer_head *lbh;
+ int exp_count;
+
+ /* Check to see if the number of pointers we found is a power of 2.
+ It needs to be and if it's not we need to fix it.*/
+ while (divisor > 1) {
+ factor++;
+ divisor /= 2;
+ multiple = multiple << 1;
+ }
+ if (*ref_count != multiple) {
+ log_err( _("Directory #%llu (0x%llx) has an invalid number of "
+ "pointers to leaf #%llu (0x%llx)\n\tFound: %u, "
+ "which is not a factor of 2.\n"),
+ (unsigned long long)ip->i_di.di_num.no_addr,
+ (unsigned long long)ip->i_di.di_num.no_addr,
+ (unsigned long long)leafno,
+ (unsigned long long)leafno, *ref_count);
+ if (!query( _("Attempt to fix it? (y/n) "))) {
+ log_err( _("Directory inode was not fixed.\n"));
+ return 1;
+ }
+ error = fix_leaf_pointers(ip, lindex, *ref_count, multiple);
+ if (error)
+ return error;
+ *ref_count = multiple;
+ log_err( _("Directory inode was fixed.\n"));
+ }
+ /* Check to see if the counted number of leaf pointers is what we
+ expect based on the leaf depth. */
+ exp_count = (1 << (ip->i_di.di_depth - leaf->lf_depth));
+ if (*ref_count != exp_count) {
+ log_err( _("Directory #%llu (0x%llx) has an incorrect number "
+ "of pointers to leaf #%llu (0x%llx)\n\tFound: "
+ "%u, Expected: %u\n"),
+ (unsigned long long)ip->i_di.di_num.no_addr,
+ (unsigned long long)ip->i_di.di_num.no_addr,
+ (unsigned long long)leafno,
+ (unsigned long long)leafno, *ref_count, exp_count);
+ if (!query( _("Attempt to fix it? (y/n) "))) {
+ log_err( _("Directory leaf was not fixed.\n"));
+ return 1;
+ }
+ lbh = bread(ip->i_sbd, leafno);
+ gfs2_leaf_in(leaf, lbh);
+ log_err( _("Leaf depth was %d, changed to %d\n"),
+ leaf->lf_depth, ip->i_di.di_depth - factor);
+ leaf->lf_depth = ip->i_di.di_depth - factor;
+ gfs2_leaf_out(leaf, lbh);
+ brelse(lbh);
+ log_err( _("Directory leaf was fixed.\n"));
+ }
+ return 0;
+}
+
+static int check_leaf(struct gfs2_inode *ip, uint64_t block, void *private)
{
struct block_count *bc = (struct block_count *) private;
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=bfea7d7ff12f2…
Commit: bfea7d7ff12f29441a26119a274148dcf3608723
Parent: dfbfbf58c8185246746a78e04ddbe8446ca6f1cf
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Aug 8 16:20:14 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 5 06:24:59 2013 -0700
fsck.gfs2: fsck.gfs2: Don't stop invalidating blocks on invalid
When fsck found a duplicate reference to a block it invalidated the dinode's
metadata. But if it encountered an invalid block, for example, out of range,
the invalidating would stop. If we encounter a block that isn't valid, we
obviously can't invalidate it. However, if we return an error, all future
invalidating will stop for that dinode. That's wrong because we need it to
continue to invalidate the other valid blocks. If we don't do this, block
references that follow the bad one that are also referenced elsewhere
(duplicates) won't be flagged as such. As a result, they'll be freed when
this corrupt dinode is deleted, despite being used by another dinode as a
valid block. This patch makes it return a good return code so the invalidating
continues.
rhbz#877150
---
gfs2/fsck/pass1.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 1b40c9f..9aac8fb 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -839,8 +839,15 @@ static int mark_block_invalid(struct gfs2_inode *ip, uint64_t block,
{
uint8_t q;
- if (!valid_block(ip->i_sbd, block) != 0)
- return -EFAULT;
+ /* If the block isn't valid, we obviously can't invalidate it.
+ * However, if we return an error, invalidating will stop, and
+ * we want it to continue to invalidate the valid blocks. If we
+ * don't do this, block references that follow that are also
+ * referenced elsewhere (duplicates) won't be flagged as such,
+ * and as a result, they'll be freed when this dinode is deleted,
+ * despite being used by another dinode as a valid block. */
+ if (!valid_block(ip->i_sbd, block))
+ return 0;
q = block_type(block);
if (q != gfs2_block_free) {
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=6abf82b395e06…
Commit: 6abf82b395e06777208324162a1f6e35da53540c
Parent: d078d98871ee8065ba0421bdc76c987bf50a428e
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Aug 8 15:16:01 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 5 06:24:59 2013 -0700
fsck.gfs2: fsck.gfs2: Ask to reclaim unlinked meta per-rgrp only
Before this patch, fsck.gfs2 would ask for every unlinked metadata bit
whether you wanted to reclaim it as free space. This patch makes it
ask only once per resource group, and reports which resource group
so that the user doesn't think it's stuck in an infinite loop.
rhbz#877150
---
gfs2/fsck/initialize.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index ee33988..85500a9 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -205,7 +205,7 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
int *this_rg_bad)
{
uint32_t rg_free, rg_reclaimed;
- int rgb, x, y, off, bytes_to_check, total_bytes_to_check;
+ int rgb, x, y, off, bytes_to_check, total_bytes_to_check, asked = 0;
unsigned int state;
rg_free = rg_reclaimed = 0;
@@ -246,9 +246,17 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
}
/* GFS2_BLKST_UNLINKED */
*this_rg_bad = 1;
- if (!(*fixit)) {
- if (query(_("Okay to reclaim unlinked "
- "inodes? (y/n)")))
+ if (!asked) {
+ char msg[256];
+
+ asked = 1;
+ sprintf(msg,
+ _("Okay to reclaim unlinked "
+ "inodes in resource group "
+ "%lld (0x%llx)? (y/n)"),
+ (unsigned long long)rgd->ri.ri_addr,
+ (unsigned long long)rgd->ri.ri_addr);
+ if (query("%s", msg))
*fixit = 1;
}
if (!(*fixit))
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=d078d98871ee8…
Commit: d078d98871ee8065ba0421bdc76c987bf50a428e
Parent: f48938510d7b96e93b9578a68d1e854783f95e87
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Aug 8 14:47:49 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Apr 5 06:24:59 2013 -0700
dirent_repair needs to mark the buffer as modified
This patch adds a call to bmodified to function dirent_repair. Without
setting the modified bit, directory repairs may be forgotten and never
written back to disk, leaving the damage in place.
rhbz#877150
---
gfs2/fsck/metawalk.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 119271d..6b3c7f0 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -278,6 +278,7 @@ static int dirent_repair(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
de->de_rec_len = GFS2_DIRENT_SIZE(de->de_name_len);
}
gfs2_dirent_out(de, (char *)dent);
+ bmodified(bh);
return 0;
}