提交 66a4cb18 编写于 作者: T Theodore Ts'o

jbd2: improve error messages for inconsistent journal heads

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=60786Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
上级 0bfea811
...@@ -259,6 +259,16 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line, ...@@ -259,6 +259,16 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
if (WARN_ON_ONCE(err)) { if (WARN_ON_ONCE(err)) {
ext4_journal_abort_handle(where, line, __func__, bh, ext4_journal_abort_handle(where, line, __func__, bh,
handle, err); 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, ext4_error_inode(inode, where, line,
bh->b_blocknr, bh->b_blocknr,
"journal_dirty_metadata failed: " "journal_dirty_metadata failed: "
......
...@@ -1313,7 +1313,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) ...@@ -1313,7 +1313,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
journal->j_running_transaction)) { journal->j_running_transaction)) {
printk(KERN_ERR "JBD2: %s: " printk(KERN_ERR "JBD2: %s: "
"jh->b_transaction (%llu, %p, %u) != " "jh->b_transaction (%llu, %p, %u) != "
"journal->j_running_transaction (%p, %u)", "journal->j_running_transaction (%p, %u)\n",
journal->j_devname, journal->j_devname,
(unsigned long long) bh->b_blocknr, (unsigned long long) bh->b_blocknr,
jh->b_transaction, jh->b_transaction,
...@@ -1336,30 +1336,25 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) ...@@ -1336,30 +1336,25 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
*/ */
if (jh->b_transaction != transaction) { if (jh->b_transaction != transaction) {
JBUFFER_TRACE(jh, "already on other transaction"); JBUFFER_TRACE(jh, "already on other transaction");
if (unlikely(jh->b_transaction != if (unlikely(((jh->b_transaction !=
journal->j_committing_transaction)) { journal->j_committing_transaction)) ||
printk(KERN_ERR "JBD2: %s: " (jh->b_next_transaction != transaction))) {
"jh->b_transaction (%llu, %p, %u) != " printk(KERN_ERR "jbd2_journal_dirty_metadata: %s: "
"journal->j_committing_transaction (%p, %u)", "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, journal->j_devname,
(unsigned long long) bh->b_blocknr, (unsigned long long) bh->b_blocknr,
transaction, transaction->t_tid,
jh->b_transaction, jh->b_transaction,
jh->b_transaction ? jh->b_transaction->t_tid : 0, jh->b_transaction ?
journal->j_committing_transaction, jh->b_transaction->t_tid : 0,
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_next_transaction, jh->b_next_transaction,
jh->b_next_transaction ? jh->b_next_transaction ?
jh->b_next_transaction->t_tid : 0, jh->b_next_transaction->t_tid : 0,
transaction, transaction->t_tid); jh->b_jlist);
WARN_ON(1);
ret = -EINVAL; ret = -EINVAL;
} }
/* And this case is illegal: we can't reuse another /* And this case is illegal: we can't reuse another
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册