@@ -690,57 +690,35 @@ static int do_one_pass(journal_t *journal,
690
690
* number. */
691
691
if (pass == PASS_SCAN &&
692
692
jbd2_has_feature_checksum (journal )) {
693
- int chksum_err , chksum_seen ;
694
693
struct commit_header * cbh =
695
694
(struct commit_header * )bh -> b_data ;
696
695
unsigned found_chksum =
697
696
be32_to_cpu (cbh -> h_chksum [0 ]);
698
697
699
- chksum_err = chksum_seen = 0 ;
700
-
701
698
if (info -> end_transaction ) {
702
699
journal -> j_failed_commit =
703
700
info -> end_transaction ;
704
701
brelse (bh );
705
702
break ;
706
703
}
707
704
708
- if (crc32_sum == found_chksum &&
709
- cbh -> h_chksum_type == JBD2_CRC32_CHKSUM &&
710
- cbh -> h_chksum_size ==
711
- JBD2_CRC32_CHKSUM_SIZE )
712
- chksum_seen = 1 ;
713
- else if (!(cbh -> h_chksum_type == 0 &&
714
- cbh -> h_chksum_size == 0 &&
715
- found_chksum == 0 &&
716
- !chksum_seen ))
717
- /*
718
- * If fs is mounted using an old kernel and then
719
- * kernel with journal_chksum is used then we
720
- * get a situation where the journal flag has
721
- * checksum flag set but checksums are not
722
- * present i.e chksum = 0, in the individual
723
- * commit blocks.
724
- * Hence to avoid checksum failures, in this
725
- * situation, this extra check is added.
726
- */
727
- chksum_err = 1 ;
728
-
729
- if (chksum_err ) {
730
- info -> end_transaction = next_commit_ID ;
731
-
732
- if (!jbd2_has_feature_async_commit (journal )) {
733
- journal -> j_failed_commit =
734
- next_commit_ID ;
735
- brelse (bh );
736
- break ;
737
- }
738
- }
705
+ /* Neither checksum match nor unused? */
706
+ if (!((crc32_sum == found_chksum &&
707
+ cbh -> h_chksum_type ==
708
+ JBD2_CRC32_CHKSUM &&
709
+ cbh -> h_chksum_size ==
710
+ JBD2_CRC32_CHKSUM_SIZE ) ||
711
+ (cbh -> h_chksum_type == 0 &&
712
+ cbh -> h_chksum_size == 0 &&
713
+ found_chksum == 0 )))
714
+ goto chksum_error ;
715
+
739
716
crc32_sum = ~0 ;
740
717
}
741
718
if (pass == PASS_SCAN &&
742
719
!jbd2_commit_block_csum_verify (journal ,
743
720
bh -> b_data )) {
721
+ chksum_error :
744
722
info -> end_transaction = next_commit_ID ;
745
723
746
724
if (!jbd2_has_feature_async_commit (journal )) {
0 commit comments