aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2014-03-12 16:38:03 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-03-12 16:38:03 -0400
commit66a4cb187b92ca8663203fe8fda621e6585a2a00 (patch)
treede342428a303fe10842e04b81514be5cf582f7db /fs
parent0bfea8118d8e4f6aeb476511350d649e8dcb0ce8 (diff)
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=60786 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/ext4_jbd2.c10
-rw-r--r--fs/jbd2/transaction.c33
2 files changed, 24 insertions, 19 deletions
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index 3fe29de832c8..c3fb607413ed 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,
259 if (WARN_ON_ONCE(err)) { 259 if (WARN_ON_ONCE(err)) {
260 ext4_journal_abort_handle(where, line, __func__, bh, 260 ext4_journal_abort_handle(where, line, __func__, bh,
261 handle, err); 261 handle, err);
262 if (inode == NULL) {
263 pr_err("EXT4: jbd2_journal_dirty_metadata "
264 "failed: handle type %u started at "
265 "line %u, credits %u/%u, errcode %d",
266 handle->h_type,
267 handle->h_line_no,
268 handle->h_requested_credits,
269 handle->h_buffer_credits, err);
270 return err;
271 }
262 ext4_error_inode(inode, where, line, 272 ext4_error_inode(inode, where, line,
263 bh->b_blocknr, 273 bh->b_blocknr,
264 "journal_dirty_metadata failed: " 274 "journal_dirty_metadata failed: "
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index d999b1f6847c..38cfcf5f6fce 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)
1313 journal->j_running_transaction)) { 1313 journal->j_running_transaction)) {
1314 printk(KERN_ERR "JBD2: %s: " 1314 printk(KERN_ERR "JBD2: %s: "
1315 "jh->b_transaction (%llu, %p, %u) != " 1315 "jh->b_transaction (%llu, %p, %u) != "
1316 "journal->j_running_transaction (%p, %u)", 1316 "journal->j_running_transaction (%p, %u)\n",
1317 journal->j_devname, 1317 journal->j_devname,
1318 (unsigned long long) bh->b_blocknr, 1318 (unsigned long long) bh->b_blocknr,
1319 jh->b_transaction, 1319 jh->b_transaction,
@@ -1336,30 +1336,25 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
1336 */ 1336 */
1337 if (jh->b_transaction != transaction) { 1337 if (jh->b_transaction != transaction) {
1338 JBUFFER_TRACE(jh, "already on other transaction"); 1338 JBUFFER_TRACE(jh, "already on other transaction");
1339 if (unlikely(jh->b_transaction != 1339 if (unlikely(((jh->b_transaction !=
1340 journal->j_committing_transaction)) { 1340 journal->j_committing_transaction)) ||
1341 printk(KERN_ERR "JBD2: %s: " 1341 (jh->b_next_transaction != transaction))) {
1342 "jh->b_transaction (%llu, %p, %u) != " 1342 printk(KERN_ERR "jbd2_journal_dirty_metadata: %s: "
1343 "journal->j_committing_transaction (%p, %u)", 1343 "bad jh for block %llu: "
1344 "transaction (%p, %u), "
1345 "jh->b_transaction (%p, %u), "
1346 "jh->b_next_transaction (%p, %u), jlist %u\n",
1344 journal->j_devname, 1347 journal->j_devname,
1345 (unsigned long long) bh->b_blocknr, 1348 (unsigned long long) bh->b_blocknr,
1349 transaction, transaction->t_tid,
1346 jh->b_transaction, 1350 jh->b_transaction,
1347 jh->b_transaction ? jh->b_transaction->t_tid : 0, 1351 jh->b_transaction ?
1348 journal->j_committing_transaction, 1352 jh->b_transaction->t_tid : 0,
1349 journal->j_committing_transaction ?
1350 journal->j_committing_transaction->t_tid : 0);
1351 ret = -EINVAL;
1352 }
1353 if (unlikely(jh->b_next_transaction != transaction)) {
1354 printk(KERN_ERR "JBD2: %s: "
1355 "jh->b_next_transaction (%llu, %p, %u) != "
1356 "transaction (%p, %u)",
1357 journal->j_devname,
1358 (unsigned long long) bh->b_blocknr,
1359 jh->b_next_transaction, 1353 jh->b_next_transaction,
1360 jh->b_next_transaction ? 1354 jh->b_next_transaction ?
1361 jh->b_next_transaction->t_tid : 0, 1355 jh->b_next_transaction->t_tid : 0,
1362 transaction, transaction->t_tid); 1356 jh->b_jlist);
1357 WARN_ON(1);
1363 ret = -EINVAL; 1358 ret = -EINVAL;
1364 } 1359 }
1365 /* And this case is illegal: we can't reuse another 1360 /* And this case is illegal: we can't reuse another