Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: dd3b502a1900ae94d5eb569cd7f2ad06436bb15e
Parent: cecd340f67bda6d65465b13a018dd1a1fe5692a5
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Fri Jan 8 13:20:24 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Jan 8 13:20:24 2010 -0600
gfs_fsck: Don't try to convert free_meta to free if -n was specified.
The code was checking free_meta blocks and free inodes and counting
them as errors even if -n was specified on gfs_fsck. But free_meta
blocks aren't technically an error and gfs_fsck's converting them to
free blocks is a convenience, so if -n was specified, don't treat
them as errors.
rhbz#508978
---
gfs/gfs_fsck/pass4.c | 70 +++++++++++++++++++++++++++----------------------
gfs/gfs_fsck/pass5.c | 10 +++++--
2 files changed, 46 insertions(+), 34 deletions(-)
diff --git a/gfs/gfs_fsck/pass4.c b/gfs/gfs_fsck/pass4.c
index be900ec..1adb355 100644
--- a/gfs/gfs_fsck/pass4.c
+++ b/gfs/gfs_fsck/pass4.c
@@ -131,40 +131,48 @@ static int scan_inode_list(struct fsck_sb *sbp, osi_list_t *list) {
stack;
return -1;
}
- /* We don't want to clear zero-size files with
- * eattrs - there might be relevent info in
- * them. */
- if(!ip->i_di.di_size && !ip->i_di.di_eattr){
- log_err("Unlinked inode has zero size\n");
+ if(!sbp->opts->no) {
+ /* We don't want to clear zero-size files with
+ * eattrs - there might be relevent info in
+ * them. */
+ if(!ip->i_di.di_size && !ip->i_di.di_eattr){
+ log_err("Unlinked inode has zero "
+ "size\n");
+ errors_found++;
+ if(query(sbp, "Clear zero-size "
+ "unlinked inode? (y/n) ")) {
+ errors_corrected++;
+ block_set(sbp->bl, ii->inode,
+ block_free);
+ free_inode(&ip);
+ log_err("Unlinked inode with "
+ "zero size cleared\n");
+ continue;
+ } else
+ log_err("Unlinked inode with "
+ "zero size not "
+ "cleared\n");
+ }
errors_found++;
- if(query(sbp, "Clear zero-size unlinked inode? (y/n) ")) {
- errors_corrected++;
- block_set(sbp->bl, ii->inode, block_free);
- free_inode(&ip);
- log_err("Unlinked inode with zero size cleared\n");
- continue;
+ if(query(sbp, "Add unlinked inode to l+f? "
+ "(y/n)")) {
+ if(add_inode_to_lf(ip)) {
+ stack;
+ free_inode(&ip);
+ log_err("Unable to unlinked "
+ "inode to l+f\n");
+ return -1;
+ } else {
+ fix_inode_count(sbp, ii, ip);
+ lf_addition = 1;
+ errors_corrected++;
+ log_err("Unlinked inode added "
+ "to l+f\n");
+ }
} else
- log_err("Unlinked inode with zero size"
- " not cleared\n");
-
+ log_err("Unlinked inode left "
+ "unlinked\n");
}
- errors_found++;
- if(query(sbp, "Add unlinked inode to l+f? (y/n)")) {
- if(add_inode_to_lf(ip)) {
- stack;
- free_inode(&ip);
- log_err("Unable to unlinked inode to "
- "l+f\n");
- return -1;
- } else {
- fix_inode_count(sbp, ii, ip);
- lf_addition = 1;
- errors_corrected++;
- log_err("Unlinked inode added to "
- "l+f\n");
- }
- } else
- log_err("Unlinked inode left unlinked\n");
free_inode(&ip);
}
else if(ii->link_count != ii->counted_links) {
diff --git a/gfs/gfs_fsck/pass5.c b/gfs/gfs_fsck/pass5.c
index 1d4db05..1b01d84 100644
--- a/gfs/gfs_fsck/pass5.c
+++ b/gfs/gfs_fsck/pass5.c
@@ -215,10 +215,11 @@ static int check_block_status(struct fsck_sb *sbp, char *buffer,
unsigned int bu
rg_status, block_status, q.block_type);
if((rg_status == GFS_BLKST_FREEMETA) &&
(block_status == GFS_BLKST_FREE)) {
- errors_found++;
- log_info("Converting free metadata block at %"
- PRIu64" to a free data block\n", block);
if(!sbp->opts->no) {
+ errors_found++;
+ log_info("Converting free metadata "
+ "block at %"PRIu64" to a "
+ "free data block\n", block);
if(fs_set_bitmap(sbp, block, block_status)) {
log_warn("Failed to convert "
"free metadata block "
@@ -231,6 +232,9 @@ static int check_block_status(struct fsck_sb *sbp, char *buffer,
unsigned int bu
errors_corrected++;
}
}
+ /* If we have free_meta blocks but -n was
+ specified, we can't convert them. But it's
+ also not technically an error. */
}
else {
const char *blockstatus[] = {"Free", "Data",