reiserfs: Don't call reiserfs_get_acl() with the reiserfs lock
[safe/jmp/linux-2.6] / fs / jbd2 / recovery.c
index d36356f..7306328 100644 (file)
@@ -225,7 +225,7 @@ do {                                                                        \
  */
 int jbd2_journal_recover(journal_t *journal)
 {
-       int                     err;
+       int                     err, err2;
        journal_superblock_t *  sb;
 
        struct recovery_info    info;
@@ -263,7 +263,10 @@ int jbd2_journal_recover(journal_t *journal)
        journal->j_transaction_sequence = ++info.end_transaction;
 
        jbd2_journal_clear_revoke(journal);
-       sync_blockdev(journal->j_fs_dev);
+       err2 = sync_blockdev(journal->j_fs_dev);
+       if (!err)
+               err = err2;
+
        return err;
 }
 
@@ -344,6 +347,7 @@ static int calc_chksums(journal_t *journal, struct buffer_head *bh,
                        *crc32_sum = crc32_be(*crc32_sum, (void *)obh->b_data,
                                     obh->b_size);
                }
+               put_bh(obh);
        }
        return 0;
 }
@@ -535,7 +539,7 @@ static int do_one_pass(journal_t *journal,
                                        memcpy(nbh->b_data, obh->b_data,
                                                        journal->j_blocksize);
                                        if (flags & JBD2_FLAG_ESCAPE) {
-                                               *((__be32 *)bh->b_data) =
+                                               *((__be32 *)nbh->b_data) =
                                                cpu_to_be32(JBD2_MAGIC_NUMBER);
                                        }
 
@@ -610,9 +614,8 @@ static int do_one_pass(journal_t *journal,
                                chksum_err = chksum_seen = 0;
 
                                if (info->end_transaction) {
-                                       printk(KERN_ERR "JBD: Transaction %u "
-                                               "found to be corrupt.\n",
-                                               next_commit_ID - 1);
+                                       journal->j_failed_commit =
+                                               info->end_transaction;
                                        brelse(bh);
                                        break;
                                }
@@ -641,12 +644,10 @@ static int do_one_pass(journal_t *journal,
                                if (chksum_err) {
                                        info->end_transaction = next_commit_ID;
 
-                                       if (!JBD2_HAS_COMPAT_FEATURE(journal,
+                                       if (!JBD2_HAS_INCOMPAT_FEATURE(journal,
                                           JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)){
-                                               printk(KERN_ERR
-                                                      "JBD: Transaction %u "
-                                                      "found to be corrupt.\n",
-                                                      next_commit_ID);
+                                               journal->j_failed_commit =
+                                                       next_commit_ID;
                                                brelse(bh);
                                                break;
                                        }