Skip to content

Commit

Permalink
jbd,jbd2: fix oops in jbd2_journal_put_journal_head()
Browse files Browse the repository at this point in the history
Commit ae4647f (jbd2: reduce journal_head size) introduced a
regression where we occasionally hit panic in
jbd2_journal_put_journal_head() because of wrong b_jcount. The bug is
caused by gcc making 64-bit access to 32-bit bitfield and thus
clobbering b_jcount.

At least for now, those 8 bytes saved in struct journal_head are not
worth the trouble with gcc bitfield handling so revert that part of
the patch.

Reported-by: EUNBONG SONG <eunb.song@samsung.com>
Reported-by: Tony Luck <tony.luck@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Jan Kara authored and Theodore Ts'o committed May 13, 2013
1 parent a549984 commit e2555fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/linux/journal-head.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ struct journal_head {

/*
* Journalling list for this buffer [jbd_lock_bh_state()]
* NOTE: We *cannot* combine this with b_modified into a bitfield
* as gcc would then (which the C standard allows but which is
* very unuseful) make 64-bit accesses to the bitfield and clobber
* b_jcount if its update races with bitfield modification.
*/
unsigned b_jlist:4;
unsigned b_jlist;

/*
* This flag signals the buffer has been modified by
* the currently running transaction
* [jbd_lock_bh_state()]
*/
unsigned b_modified:1;
unsigned b_modified;

/*
* Copy of the buffer data frozen for writing to the log.
Expand Down

0 comments on commit e2555fd

Please sign in to comment.