diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-11-13 17:49:12 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:36:52 -0500 |
commit | 10995aa2451afa20b721cc7de856cae1a13dba57 (patch) | |
tree | 63129e7d752fb018dc76aa42de136baa4a8a4232 /fs/ocfs2/journal.c | |
parent | b657c95c11088d77fc1bfc9c84d940f778bf9d12 (diff) |
ocfs2: Morph the haphazard OCFS2_IS_VALID_DINODE() checks.
Random places in the code would check a dinode bh to see if it was
valid. Not only did they do different levels of validation, they
handled errors in different ways.
The previous commit unified inode block reads, validating all block
reads in the same place. Thus, these haphazard checks are no longer
necessary. Rather than eliminate them, however, we change them to
BUG_ON() checks. This ensures the assumptions remain true. All of the
code paths to these checks have been audited to ensure they come from a
validated inode read.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 877aaa05e199..9223bfcca3ba 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -587,17 +587,11 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, | |||
587 | mlog_entry_void(); | 587 | mlog_entry_void(); |
588 | 588 | ||
589 | fe = (struct ocfs2_dinode *)bh->b_data; | 589 | fe = (struct ocfs2_dinode *)bh->b_data; |
590 | if (!OCFS2_IS_VALID_DINODE(fe)) { | 590 | |
591 | /* This is called from startup/shutdown which will | 591 | /* The journal bh on the osb always comes from ocfs2_journal_init() |
592 | * handle the errors in a specific manner, so no need | 592 | * and was validated there inside ocfs2_inode_lock_full(). It's a |
593 | * to call ocfs2_error() here. */ | 593 | * code bug if we mess it up. */ |
594 | mlog(ML_ERROR, "Journal dinode %llu has invalid " | 594 | BUG_ON(!OCFS2_IS_VALID_DINODE(fe)); |
595 | "signature: %.*s", | ||
596 | (unsigned long long)le64_to_cpu(fe->i_blkno), 7, | ||
597 | fe->i_signature); | ||
598 | status = -EIO; | ||
599 | goto out; | ||
600 | } | ||
601 | 595 | ||
602 | flags = le32_to_cpu(fe->id1.journal1.ij_flags); | 596 | flags = le32_to_cpu(fe->id1.journal1.ij_flags); |
603 | if (dirty) | 597 | if (dirty) |
@@ -613,7 +607,6 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, | |||
613 | if (status < 0) | 607 | if (status < 0) |
614 | mlog_errno(status); | 608 | mlog_errno(status); |
615 | 609 | ||
616 | out: | ||
617 | mlog_exit(status); | 610 | mlog_exit(status); |
618 | return status; | 611 | return status; |
619 | } | 612 | } |