From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [gfs2-utils PATCH 07/20] fsck.gfs2: Don't just assume the remaining EA reference is good
Date: Mon, 28 Sep 2015 09:45:52 -0500 [thread overview]
Message-ID: <c8fc581424c37f093a87fd4e5a78f33d8b8f30fb.1443450920.git.rpeterso@redhat.com> (raw)
In-Reply-To: <cover.1443450920.git.rpeterso@redhat.com>
When pass1b is resolving duplicate block references, it pares them
down to the last reference, then sets the block type from that
last reference. However, the last reference might be bad too.
For example, consider a block referenced as data by two corrupt inodes
and referenced as an extended attribute by a third corrupt inode.
In pass1b, it might eliminate the two inodes that referenced it as
data, then set the block as extended attribute based on the remaining
reference. However, if the block is not really an extended attribute,
that would be an error that would only be caught on a subsequent run.
This patch adds a check to make sure the remaining reference as an
extended attribute is also valid. If not, the block is freed.
rhbz#1257625
---
gfs2/fsck/pass1b.c | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 83a506c..4d16635 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -417,11 +417,40 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt,
sdp->gfs1 ? GFS2_BLKST_DINODE :
GFS2_BLKST_USED);
} else {
- fsck_blockmap_set(ip, dt->block,
- _("reference-repaired extended "
- "attribute"),
- sdp->gfs1 ? GFS2_BLKST_DINODE :
- GFS2_BLKST_USED);
+ if (acceptable_ref == ref_as_ea)
+ fsck_blockmap_set(ip, dt->block,
+ _("reference-repaired extended "
+ "attribute"),
+ sdp->gfs1 ? GFS2_BLKST_DINODE :
+ GFS2_BLKST_USED);
+ else {
+ log_err(_("Error: The remaining reference to block "
+ " %lld (0x%llx) is as extended attribute, "
+ "in inode %lld (0x%llx) but the block is "
+ "not an EA.\n"),
+ (unsigned long long)dt->block,
+ (unsigned long long)dt->block,
+ (unsigned long long)id->block_no,
+ (unsigned long long)id->block_no);
+ if (query(_("Okay to remove the bad extended "
+ "attribute from inode %lld (0x%llx)? "
+ "(y/n) "),
+ (unsigned long long)id->block_no,
+ (unsigned long long)id->block_no)) {
+ ip->i_di.di_eattr = 0;
+ ip->i_di.di_flags &= ~GFS2_DIF_EA_INDIRECT;
+ ip->i_di.di_blocks--;
+ bmodified(ip->i_bh);
+ fsck_blockmap_set(ip, dt->block,
+ _("reference-repaired EA"),
+ GFS2_BLKST_FREE);
+ log_err(_("The bad extended attribute was "
+ "removed.\n"));
+ } else {
+ log_err(_("The bad extended attribute was not "
+ "removed.\n"));
+ }
+ }
}
fsck_inode_put(&ip); /* out, brelse, free */
log_debug(_("Done with duplicate reference to block 0x%llx\n"),
--
2.4.3
next prev parent reply other threads:[~2015-09-28 14:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 14:45 [Cluster-devel] [gfs2-utils PATCH 00/20] fsck.gfs2: Fix bugs and eliminate pass1c Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 01/20] libgfs2: Check block range when inserting into rgrp tree Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 02/20] libgfs2: Check rgd->bits before referencing it Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 03/20] fsck.gfs2: Add check for gfs1 invalid inode refs in dentry Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 04/20] fsck.gfs2: Make debug messages more succinct wrt extended attributes Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 05/20] fsck.gfs2: Break up funtion handle_dup_blk Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 06/20] fsck.gfs2: Only preserve the _first_ acceptable inode reference Bob Peterson
2015-09-28 14:45 ` Bob Peterson [this message]
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 08/20] fsck.gfs2: Don't delete inode for duplicate reference in EA Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 09/20] fsck.gfs2: Don't traverse EAs that belong to another inode Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 10/20] fsck.gfs2: Refactor function check_indirect_eattr Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 11/20] fsck.gfs2: Once an indirect ea error is found, flag all that follow Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 12/20] fsck.gfs2: Always restore saved value for di_eattr Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 13/20] fsck.gfs2: Remove redundancy in add_duplicate_ref Bob Peterson
2015-09-28 14:45 ` [Cluster-devel] [gfs2-utils PATCH 14/20] fsck.gfs2: Don't remove duplicate eattr blocks Bob Peterson
2015-09-28 14:46 ` [Cluster-devel] [gfs2-utils PATCH 15/20] fsck.gfs2: Refactor check_eattr_entries and add error messages Bob Peterson
2015-09-28 14:46 ` [Cluster-devel] [gfs2-utils PATCH 16/20] fsck.gfs2: remove bad EAs at the end, not as-you-go Bob Peterson
2015-09-28 14:46 ` [Cluster-devel] [gfs2-utils PATCH 17/20] fsck.gfs2: Combine remove_inode_eattr with its only caller Bob Peterson
2015-09-28 14:46 ` [Cluster-devel] [gfs2-utils PATCH 18/20] fsck.gfs2: Print debug message to dilineate metadata blocks Bob Peterson
2015-09-28 14:46 ` [Cluster-devel] [gfs2-utils PATCH 19/20] fsck.gfs2: Remove pass1c in favor of processing in pass1 Bob Peterson
2015-09-28 14:46 ` [Cluster-devel] [gfs2-utils PATCH 20/20] fsck.gfs2: Clone duplicate data block pointers Bob Peterson
2015-09-29 18:02 ` [Cluster-devel] [gfs2-utils PATCH 00/20] fsck.gfs2: Fix bugs and eliminate pass1c Andrew Price
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=c8fc581424c37f093a87fd4e5a78f33d8b8f30fb.1443450920.git.rpeterso@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).