Gitweb:
http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=6a519784...
Commit: 6a5197849a38cfa3430642c758c4bb603713f9c7
Parent: 3006c68feb0da6f26d00ade419af0b8d3be30ef1
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon Jul 15 14:11:34 2013 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Wed Jul 17 07:31:36 2013 -0500
fsck.gfs2: don't check newly created lost+found in pass2
This patch checks whether lost+found was created during the run
and if so, it skips pass2 directory checking for lost+found.
The reason we need to do this is because when lost+found is created,
it sets the directory linkage count to 1. If pass2 checks the
directory, it will add it a second time because it checks it like
every other normal directory. Therefore, the linkage counts get off.
Plus, it's a waste of time to check it, since we just built it.
rhbz#984085
---
gfs2/fsck/fsck.h | 1 +
gfs2/fsck/lost_n_found.c | 1 +
gfs2/fsck/main.c | 1 +
gfs2/fsck/pass2.c | 8 ++++++++
4 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index 6d888af..8555e9e 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -131,6 +131,7 @@ struct gfs2_options {
extern struct gfs2_options opts;
extern struct gfs2_inode *lf_dip; /* Lost and found directory inode */
+extern int lf_was_created;
extern struct gfs2_bmap *bl;
extern uint64_t last_fs_block, last_reported_block;
extern int64_t last_reported_fblock;
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index 3226ac9..919cb2f 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -132,6 +132,7 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
q = block_type(lf_dip->i_di.di_num.no_addr);
if (q != gfs2_inode_dir) {
+ lf_was_created = 1;
/* This is a new lost+found directory, so set its block type
and increment link counts for the directories */
/* FIXME: i'd feel better about this if fs_mkdir returned
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index 9c3b06d..287404d 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -22,6 +22,7 @@
struct gfs2_options opts = {0};
struct gfs2_inode *lf_dip = NULL; /* Lost and found directory inode */
+int lf_was_created = 0;
struct gfs2_bmap *bl = NULL;
uint64_t last_fs_block, last_reported_block = -1;
int64_t last_reported_fblock = -1000000;
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index dabfc13..f97e494 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -1683,6 +1683,14 @@ int pass2(struct gfs2_sbd *sdp)
if (q != gfs2_inode_dir)
continue;
+ /* If we created lost+found, its links should have been
+ properly adjusted, so don't check it. */
+ if (lf_was_created &&
+ (dirblk == lf_dip->i_di.di_num.no_addr)) {
+ log_debug(_("Pass2 skipping the new lost+found.\n"));
+ continue;
+ }
+
log_debug( _("Checking directory inode at block %llu (0x%llx)\n"),
(unsigned long long)dirblk, (unsigned long long)dirblk);