From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [Patch 26/44] fsck.gfs2 pass2: Only delete metadata if "bad" (not "invalid") inode
Date: Thu, 11 Aug 2011 17:10:26 -0400 (EDT) [thread overview]
Message-ID: <1543321233.544892.1313097026049.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> (raw)
From 61c30e4c549d5de8e9a668b9e34bde071ed704ce Mon Sep 17 00:00:00 2001
From: Bob Peterson <rpeterso@redhat.com>
Date: Tue, 9 Aug 2011 13:01:05 -0500
Subject: [PATCH 26/44] fsck.gfs pass2: Only delete metadata if "bad" (not
"invalid") inode
In pass2, all metadata was deleted for inodes that were marked either
"bad" or "invalid" but that is wrong, and here is why:
Blocks marked "invalid" were invalidated due to duplicate block references.
Pass1b should have already taken care of deleting their metadata, so in pass2
we only need to delete the directory entries pointing to them. We delete the
metadata in pass1b because we need to eliminate the inode referencing the
duplicate-referenced block from the list of candidates to keep. So we have a
delete-as-we-go policy. Blocks marked "bad" need to have their entire
metadata tree deleted.
rhbz#675723
---
gfs2/fsck/pass2.c | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 2ee3fe7..4a6073a 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -319,6 +319,18 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
q = block_type(entryblock);
/* Get the status of the directory inode */
+ /**
+ * 1. Blocks marked "invalid" were invalidated due to duplicate
+ * block references. Pass1b should have already taken care of deleting
+ * their metadata, so here we only need to delete the directory entries
+ * pointing to them. We delete the metadata in pass1b because we need
+ * to eliminate the inode referencing the duplicate-referenced block
+ * from the list of candidates to keep. So we have a delete-as-we-go
+ * policy.
+ *
+ * 2. Blocks marked "bad" need to have their entire
+ * metadata tree deleted.
+ */
if (q == gfs2_inode_invalid || q == gfs2_bad_block) {
/* This entry's inode has bad blocks in it */
@@ -333,14 +345,16 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
goto dentry_is_valid;
}
- if (ip->i_di.di_num.no_addr == entryblock)
- entry_ip = ip;
- else
- entry_ip = fsck_load_inode(sdp, entryblock);
- check_inode_eattr(entry_ip, &pass2_fxns_delete);
- check_metatree(entry_ip, &pass2_fxns_delete);
- if (entry_ip != ip)
- fsck_inode_put(&entry_ip);
+ if (q == gfs2_bad_block) {
+ if (ip->i_di.di_num.no_addr == entryblock)
+ entry_ip = ip;
+ else
+ entry_ip = fsck_load_inode(sdp, entryblock);
+ check_inode_eattr(entry_ip, &pass2_fxns_delete);
+ check_metatree(entry_ip, &pass2_fxns_delete);
+ if (entry_ip != ip)
+ fsck_inode_put(&entry_ip);
+ }
fsck_blockmap_set(ip, entryblock,
_("bad directory entry"), gfs2_block_free);
log_err( _("Inode %lld (0x%llx) was deleted.\n"),
--
1.7.4.4
reply other threads:[~2011-08-11 21:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1543321233.544892.1313097026049.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com \
--to=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).