Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdif…
Commit: 7c005938ea27cde2877cd284862e9082ccaa2aea
Parent: 02adf68abe793100cf123cb83989200500331340
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed Aug 31 08:02:09 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Wed Aug 31 08:02:09 2011 -0500
Change man pages and gfs2_convert messages to include GFS
Since fsck.gfs2 can now handle GFS1 file systems, this patch changes
the message in gfs2_convert and the man pages to reflect that.
rhbz#675723
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/man/fsck.gfs2.8 | 9 +++++----
gfs2/man/gfs2_convert.8 | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 78a87dd..396e899 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1615,7 +1615,7 @@ static void give_warning(void)
printf(_("WARNING: This can't be undone. It is strongly advised " \
"that you:\n\n"));
printf(_(" 1. Back up your entire filesystem first.\n"));
- printf(_(" 2. Run gfs_fsck first to ensure filesystem integrity.\n"));
+ printf(_(" 2. Run fsck.gfs2 first to ensure filesystem integrity.\n"));
printf(_(" 3. Make sure the filesystem is NOT mounted from any node.\n"));
printf(_(" 4. Make sure you have the latest software versions.\n"));
}/* give_warning */
diff --git a/gfs2/man/fsck.gfs2.8 b/gfs2/man/fsck.gfs2.8
index 462e918..3ecfbe3 100644
--- a/gfs2/man/fsck.gfs2.8
+++ b/gfs2/man/fsck.gfs2.8
@@ -1,18 +1,19 @@
.TH fsck.gfs2 8
.SH NAME
-fsck.gfs2 - Offline GFS2 file system checker
+fsck.gfs2 - Offline GFS and GFS2 file system checker
.SH SYNOPSIS
.B fsck.gfs2
[\fIOPTION\fR]... \fIDEVICE\fR
.SH WARNING
-All GFS2 nodes \fImust\fP have the GFS2 filesystem unmounted before running
-fsck.gfs2. Failure to unmount all nodes may result in filesystem corruption.
+All computers \fImust\fP have the filesystem unmounted before running
+fsck.gfs2. Failure to unmount from all nodes in a cluster will likely result
+in filesystem corruption.
.SH DESCRIPTION
-fsck.gfs2 will check that the GFS2 file system on a device is structurally valid.
+fsck.gfs2 will check that the GFS or GFS2 file system on a device is structurally valid.
It should not be run on a mounted file system. If file system corruption is
detected, it will attempt to repair the file system. There is a limit to what
fsck.gfs2 can do. If important file system structures are destroyed, such that
diff --git a/gfs2/man/gfs2_convert.8 b/gfs2/man/gfs2_convert.8
index 5969432..ca0f64f 100644
--- a/gfs2/man/gfs2_convert.8
+++ b/gfs2/man/gfs2_convert.8
@@ -10,7 +10,7 @@ gfs2_convert - Convert a GFS1 filesystem to GFS2
.SH DESCRIPTION
gfs2_convert is used to convert a filesystem from GFS1 to GFS2. It is
required that the GFS1 filesystem be checked and fixed for errors using
-\fBgfs_fsck\fP and that the filesystem be backed up before
+\fBfsck.gfs2\fP and that the filesystem be backed up before
attempting to convert it. The convert process is irreversible and any
error encountered during the conversion can result in the abrupt
termination of the program and consequently an unusable filesystem.
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdif…
Commit: a0af8c8c1b1c58258f2d5f91e5dca72e80ca41ca
Parent: c7c7ef6bf3f2bc2f0f09e285085a20fb17ef6aad
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Aug 23 10:30:20 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Aug 29 12:56:29 2011 -0500
fsck.gfs2: Print step 2 duplicate debug msg first
In testing fsck.gfs2 I noticed that when duplicates were resolved,
the "step 2" debug message was printed after step 2 was actually
done. That's misleading, so this patch changes it.
rhbz#675723
---
gfs2/fsck/pass1b.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index a56ea31..ae6d45c 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -645,15 +645,15 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *b)
* directory inode referencing a data block as a leaf block.
*/
if (!last_reference) {
- last_reference = resolve_dup_references(sdp, b,
- &b->ref_inode_list,
- &dh, 0,
- acceptable_ref);
log_debug( _("----------------------------------------------\n"
"Step 2: Eliminate references to block %llu "
"(0x%llx) that need the wrong block type.\n"),
(unsigned long long)b->block,
(unsigned long long)b->block);
+ last_reference = resolve_dup_references(sdp, b,
+ &b->ref_inode_list,
+ &dh, 0,
+ acceptable_ref);
}
/* Step 3 - We have multiple dinodes referencing it as the correct
* type. Just blast one of them.
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdif…
Commit: c7c7ef6bf3f2bc2f0f09e285085a20fb17ef6aad
Parent: 0f8375827cfbed2ea189fb9a05004456103c0989
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Aug 23 10:02:02 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Aug 29 12:56:29 2011 -0500
fsck.gfs2: Recognize partially gfs2-converted dinodes
In testing fsck.gfs2 I noticed that if a file system had some
leftover gfs2 dinodes (due to an interrupted gfs2_convert or
in my case, because I had previously loaded gfs2 metadata that
left gfs2 blocks laying around the gfs1 file system) those gfs2
dinodes were not properly processed. In particular, it would not
recognize gfs2-style directories as directories because of the
difference in where dinode mode information is kept. This patch
gives fsck.gfs2 the ability to correctly identify gfs2 dinodes
when checking a gfs1 file system.
rhbz#675723
---
gfs2/fsck/lost_n_found.c | 4 ++--
gfs2/fsck/util.c | 2 +-
gfs2/fsck/util.h | 11 +++++++++--
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index 625de0d..87cb01f 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -216,7 +216,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
lf_blocks = lf_dip->i_di.di_blocks;
if (sdp->gfs1)
- mode = gfs_to_gfs2_mode(ip->i_di.__pad1);
+ mode = gfs_to_gfs2_mode(ip);
else
mode = ip->i_di.di_mode & S_IFMT;
@@ -280,7 +280,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
incr_link_count(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 (is_dir(&ip->i_di, sdp->gfs1))
+ if (mode == S_IFDIR)
incr_link_count(lf_dip->i_di.di_num.no_addr,
ip->i_di.di_num.no_addr, _("to lost+found"));
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index aa3e4ff..0d243e0 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -482,7 +482,7 @@ int set_ip_blockmap(struct gfs2_inode *ip, int instree)
uint32_t mode;
if (sdp->gfs1)
- mode = gfs_to_gfs2_mode(ip->i_di.__pad1);
+ mode = gfs_to_gfs2_mode(ip);
else
mode = ip->i_di.di_mode & S_IFMT;
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index 6581cb1..2f74af3 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -143,8 +143,10 @@ static inline int is_dir(struct gfs2_dinode *dinode, int gfs1)
return 0;
}
-static inline uint32_t gfs_to_gfs2_mode(uint32_t gfs1mode)
+static inline uint32_t gfs_to_gfs2_mode(struct gfs2_inode *ip)
{
+ uint16_t gfs1mode = ip->i_di.__pad1;
+
switch (gfs1mode) {
case GFS_FILE_DIR:
return S_IFDIR;
@@ -161,7 +163,12 @@ static inline uint32_t gfs_to_gfs2_mode(uint32_t gfs1mode)
case GFS_FILE_SOCK:
return S_IFSOCK;
default:
- return S_IFREG;
+ /* This could be an aborted gfs2_convert so look for both. */
+ if (ip->i_di.di_entries ||
+ (ip->i_di.di_mode & S_IFMT) == S_IFDIR)
+ return S_IFDIR;
+ else
+ return S_IFREG;
}
}
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdif…
Commit: 0f8375827cfbed2ea189fb9a05004456103c0989
Parent: 60140c2ba6be8bf7836c5b1baae7c7a9ea3a71e7
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Aug 23 09:31:40 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon Aug 29 12:56:29 2011 -0500
fsck.gfs2: system dinodes take priority over user dinodes
In testing fsck.gfs2 I noticed some incorrect behavior: If a block
was referenced incorrectly by two dinodes, fsck deleted which
ever reference it found first. Therefore, if a system dinode
and a user dinode referenced the same block, fsck.gfs2 could
mistakenly delete the system dinode. For example, a journal could
get deleted because a user dinode improperly referenced one of its
blocks. This patch gives priority to system dinodes when resolving
duplicates.
rhbz#675723
---
gfs2/fsck/pass1b.c | 9 ++++++++-
gfs2/fsck/util.c | 14 ++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 67e878c..a56ea31 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -486,7 +486,14 @@ static int resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *b,
continue; /* don't delete the dinode */
}
}
-
+ /* If this reference is from a system inode, for example, if
+ it's data or metadata inside a journal, the reference
+ should take priority over user dinodes that reference the
+ block. */
+ if (!found_good_ref && fsck_system_inode(sdp, id->block_no)) {
+ found_good_ref = 1;
+ continue; /* don't delete the dinode */
+ }
log_warn( _("Inode %s (%lld/0x%llx) references block "
"%llu (0x%llx) as '%s', but the block is "
"really %s.\n"),
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index ae9213f..aa3e4ff 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -283,8 +283,18 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
inode reference list otherwise put it on the normal list. */
if (!inode_valid || q == gfs2_inode_invalid)
osi_list_add_prev(&id->list, &dt->ref_invinode_list);
- else
- osi_list_add_prev(&id->list, &dt->ref_inode_list);
+ else {
+ /* If this is a system dinode, we want the duplicate
+ processing to find it first. That way references
+ from inside journals, et al, will take priority.
+ We don't want to delete journals in favor of dinodes
+ that reference a block inside a journal. */
+ if (fsck_system_inode(ip->i_sbd, id->block_no))
+ osi_list_add(&id->list, &dt->ref_inode_list);
+ else
+ osi_list_add_prev(&id->list,
+ &dt->ref_inode_list);
+ }
}
id->reftypecount[reftype]++;
id->dup_count++;