Skip to content

Commit

Permalink
vfs: Add BUG_ON for delayed and unwritten flags in submit_bh()
Browse files Browse the repository at this point in the history
The BH_Delay and BH_Unwritten flags should never leak out to
submit_bh().  So add some BUG_ON() checks to submit_bh so we can get a
stack trace and determine how and why this might have happened.

(Note that only XFS and ext4 use these buffer head flags, and XFS does
not use submit_bh().  So this patch should only modify behavior for
ext4.)

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-fsdevel@vger.kernel.org
  • Loading branch information
Aneesh Kumar K.V authored and Theodore Ts'o committed May 12, 2009
1 parent 79ffab3 commit 8fb0e34
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2933,6 +2933,8 @@ int submit_bh(int rw, struct buffer_head * bh)
BUG_ON(!buffer_locked(bh));
BUG_ON(!buffer_mapped(bh));
BUG_ON(!bh->b_end_io);
BUG_ON(buffer_delay(bh));
BUG_ON(buffer_unwritten(bh));

/*
* Mask in barrier bit for a write (could be either a WRITE or a
Expand Down

0 comments on commit 8fb0e34

Please sign in to comment.