Skip to contentSkip to conversation

fsck.gfs2: Fix journal sequence number reporting problem

PATCH New Bob Peterson 2 participants 2 messages Jan 23, 2015 – Jan 26, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 fsck.gfs2: Fix journal sequence number reporting problem

Hi,

This bug was spotted by coverity. The fsck.gfs2 should include a line to report the number of journal sequence errors fixed. It was coded improperly so that it was never displayed. This patch fixes the code so that the message will be printed properly.

Regards,

Bob Peterson
Red Hat File Systems

---

gfs2/fsck/fs_recovery.c +5 -4
index abb8187..9be5a95 100644
@@ -436,10 +436,9 @@ static int check_journal_seq_no(struct gfs2_inode *ip, int fix)
 			  (unsigned long long)lowest_seq,
 			  (unsigned long long)highest_seq,
 			  (unsigned long long)prev_seq);
-		if (!fix) {
-			seq_errors++;
+		seq_errors++;
+		if (!fix)
 			continue;
-		}
 		highest_seq++;
 		lh.lh_sequence = highest_seq;
 		prev_seq = lh.lh_sequence;
@@ -449,8 +448,10 @@ static int check_journal_seq_no(struct gfs2_inode *ip, int fix)
 		gfs2_log_header_out(&lh, bh);
 		brelse(bh);
 	}
-	if (seq_errors && fix)
+	if (seq_errors && fix) {
 		log_err(_("%d sequence errors fixed.\n"), seq_errors);
+		seq_errors = 0;
+	}
 	return seq_errors;
 }
 
#2 lore raw

PATCH 1/1 fsck.gfs2: Fix journal sequence number reporting problem

Quoted 6 lines · Bob Peterson

Hi,

This bug was spotted by coverity. The fsck.gfs2 should include a line to report the number of journal sequence errors fixed. It was coded improperly so that it was never displayed. This patch fixes the code so that the message will be printed properly.

ACK - thanks for dealing with coverity complaints.

Cheers,
Andy

Quoted 38 lines

Regards,

Bob Peterson
Red Hat File Systems

---

gfs2/fsck/fs_recovery.c +5 -4
index abb8187..9be5a95 100644
@@ -436,10 +436,9 @@ static int check_journal_seq_no(struct gfs2_inode *ip, int fix)
  			  (unsigned long long)lowest_seq,
  			  (unsigned long long)highest_seq,
  			  (unsigned long long)prev_seq);
-		if (!fix) {
-			seq_errors++;
+		seq_errors++;
+		if (!fix)
  			continue;
-		}
  		highest_seq++;
  		lh.lh_sequence = highest_seq;
  		prev_seq = lh.lh_sequence;
@@ -449,8 +448,10 @@ static int check_journal_seq_no(struct gfs2_inode *ip, int fix)
  		gfs2_log_header_out(&lh, bh);
  		brelse(bh);
  	}
-	if (seq_errors && fix)
+	if (seq_errors && fix) {
  		log_err(_("%d sequence errors fixed.\n"), seq_errors);
+		seq_errors = 0;
+	}
  	return seq_errors;
  }