* [PATCH] jbd2: improve error messages for inconsistent journal heads
@ 2014-03-12 20:44 Theodore Ts'o
2014-03-13 20:28 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Theodore Ts'o @ 2014-03-12 20:44 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Theodore Ts'o
Fix up error messages printed when the transaction pointers in a
journal head are inconsistent. This improves the error messages which
are printed when running xfstests generic/068 in data=journal mode.
See the bug report at: https://bugzilla.kernel.org/show_bug.cgi?id=60786
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
fs/ext4/ext4_jbd2.c | 10 ++++++++++
fs/jbd2/transaction.c | 33 ++++++++++++++-------------------
2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index 3fe29de..c3fb607 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -259,6 +259,16 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
if (WARN_ON_ONCE(err)) {
ext4_journal_abort_handle(where, line, __func__, bh,
handle, err);
+ if (inode == NULL) {
+ pr_err("EXT4: jbd2_journal_dirty_metadata "
+ "failed: handle type %u started at "
+ "line %u, credits %u/%u, errcode %d",
+ handle->h_type,
+ handle->h_line_no,
+ handle->h_requested_credits,
+ handle->h_buffer_credits, err);
+ return err;
+ }
ext4_error_inode(inode, where, line,
bh->b_blocknr,
"journal_dirty_metadata failed: "
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index d999b1f..38cfcf5 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1313,7 +1313,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
journal->j_running_transaction)) {
printk(KERN_ERR "JBD2: %s: "
"jh->b_transaction (%llu, %p, %u) != "
- "journal->j_running_transaction (%p, %u)",
+ "journal->j_running_transaction (%p, %u)\n",
journal->j_devname,
(unsigned long long) bh->b_blocknr,
jh->b_transaction,
@@ -1336,30 +1336,25 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
*/
if (jh->b_transaction != transaction) {
JBUFFER_TRACE(jh, "already on other transaction");
- if (unlikely(jh->b_transaction !=
- journal->j_committing_transaction)) {
- printk(KERN_ERR "JBD2: %s: "
- "jh->b_transaction (%llu, %p, %u) != "
- "journal->j_committing_transaction (%p, %u)",
+ if (unlikely(((jh->b_transaction !=
+ journal->j_committing_transaction)) ||
+ (jh->b_next_transaction != transaction))) {
+ printk(KERN_ERR "jbd2_journal_dirty_metadata: %s: "
+ "bad jh for block %llu: "
+ "transaction (%p, %u), "
+ "jh->b_transaction (%p, %u), "
+ "jh->b_next_transaction (%p, %u), jlist %u\n",
journal->j_devname,
(unsigned long long) bh->b_blocknr,
+ transaction, transaction->t_tid,
jh->b_transaction,
- jh->b_transaction ? jh->b_transaction->t_tid : 0,
- journal->j_committing_transaction,
- journal->j_committing_transaction ?
- journal->j_committing_transaction->t_tid : 0);
- ret = -EINVAL;
- }
- if (unlikely(jh->b_next_transaction != transaction)) {
- printk(KERN_ERR "JBD2: %s: "
- "jh->b_next_transaction (%llu, %p, %u) != "
- "transaction (%p, %u)",
- journal->j_devname,
- (unsigned long long) bh->b_blocknr,
+ jh->b_transaction ?
+ jh->b_transaction->t_tid : 0,
jh->b_next_transaction,
jh->b_next_transaction ?
jh->b_next_transaction->t_tid : 0,
- transaction, transaction->t_tid);
+ jh->b_jlist);
+ WARN_ON(1);
ret = -EINVAL;
}
/* And this case is illegal: we can't reuse another
--
1.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] jbd2: improve error messages for inconsistent journal heads
2014-03-12 20:44 [PATCH] jbd2: improve error messages for inconsistent journal heads Theodore Ts'o
@ 2014-03-13 20:28 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2014-03-13 20:28 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Ext4 Developers List
On Wed 12-03-14 16:44:49, Ted Tso wrote:
> Fix up error messages printed when the transaction pointers in a
> journal head are inconsistent. This improves the error messages which
> are printed when running xfstests generic/068 in data=journal mode.
> See the bug report at: https://bugzilla.kernel.org/show_bug.cgi?id=60786
Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
> fs/ext4/ext4_jbd2.c | 10 ++++++++++
> fs/jbd2/transaction.c | 33 ++++++++++++++-------------------
> 2 files changed, 24 insertions(+), 19 deletions(-)
>
> diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
> index 3fe29de..c3fb607 100644
> --- a/fs/ext4/ext4_jbd2.c
> +++ b/fs/ext4/ext4_jbd2.c
> @@ -259,6 +259,16 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
> if (WARN_ON_ONCE(err)) {
> ext4_journal_abort_handle(where, line, __func__, bh,
> handle, err);
> + if (inode == NULL) {
> + pr_err("EXT4: jbd2_journal_dirty_metadata "
> + "failed: handle type %u started at "
> + "line %u, credits %u/%u, errcode %d",
> + handle->h_type,
> + handle->h_line_no,
> + handle->h_requested_credits,
> + handle->h_buffer_credits, err);
> + return err;
> + }
> ext4_error_inode(inode, where, line,
> bh->b_blocknr,
> "journal_dirty_metadata failed: "
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index d999b1f..38cfcf5 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -1313,7 +1313,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
> journal->j_running_transaction)) {
> printk(KERN_ERR "JBD2: %s: "
> "jh->b_transaction (%llu, %p, %u) != "
> - "journal->j_running_transaction (%p, %u)",
> + "journal->j_running_transaction (%p, %u)\n",
> journal->j_devname,
> (unsigned long long) bh->b_blocknr,
> jh->b_transaction,
> @@ -1336,30 +1336,25 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
> */
> if (jh->b_transaction != transaction) {
> JBUFFER_TRACE(jh, "already on other transaction");
> - if (unlikely(jh->b_transaction !=
> - journal->j_committing_transaction)) {
> - printk(KERN_ERR "JBD2: %s: "
> - "jh->b_transaction (%llu, %p, %u) != "
> - "journal->j_committing_transaction (%p, %u)",
> + if (unlikely(((jh->b_transaction !=
> + journal->j_committing_transaction)) ||
> + (jh->b_next_transaction != transaction))) {
> + printk(KERN_ERR "jbd2_journal_dirty_metadata: %s: "
> + "bad jh for block %llu: "
> + "transaction (%p, %u), "
> + "jh->b_transaction (%p, %u), "
> + "jh->b_next_transaction (%p, %u), jlist %u\n",
> journal->j_devname,
> (unsigned long long) bh->b_blocknr,
> + transaction, transaction->t_tid,
> jh->b_transaction,
> - jh->b_transaction ? jh->b_transaction->t_tid : 0,
> - journal->j_committing_transaction,
> - journal->j_committing_transaction ?
> - journal->j_committing_transaction->t_tid : 0);
> - ret = -EINVAL;
> - }
> - if (unlikely(jh->b_next_transaction != transaction)) {
> - printk(KERN_ERR "JBD2: %s: "
> - "jh->b_next_transaction (%llu, %p, %u) != "
> - "transaction (%p, %u)",
> - journal->j_devname,
> - (unsigned long long) bh->b_blocknr,
> + jh->b_transaction ?
> + jh->b_transaction->t_tid : 0,
> jh->b_next_transaction,
> jh->b_next_transaction ?
> jh->b_next_transaction->t_tid : 0,
> - transaction, transaction->t_tid);
> + jh->b_jlist);
> + WARN_ON(1);
> ret = -EINVAL;
> }
> /* And this case is illegal: we can't reuse another
> --
> 1.9.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-13 20:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-12 20:44 [PATCH] jbd2: improve error messages for inconsistent journal heads Theodore Ts'o
2014-03-13 20:28 ` Jan Kara
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).