Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206303
b: refs/heads/master
c: 4038968
h: refs/heads/master
i:
  206301: 8d97dce
  206299: 967db36
  206295: 7621b45
  206287: 129c829
  206271: 875ffcd
v: v3
  • Loading branch information
Amir G authored and Theodore Ts'o committed Jul 27, 2010
1 parent 58d3cb3 commit dc639c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a271fe8527fe9637bdd82c97123b1356940dd84b
refs/heads/master: 40389687382bf0ae71458e7c0f828137a438a956
35 changes: 13 additions & 22 deletions trunk/fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4489,27 +4489,6 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
(__le32 *) bh->b_data + addr_per_block,
depth);

/*
* We've probably journalled the indirect block several
* times during the truncate. But it's no longer
* needed and we now drop it from the transaction via
* jbd2_journal_revoke().
*
* That's easy if it's exclusively part of this
* transaction. But if it's part of the committing
* transaction then jbd2_journal_forget() will simply
* brelse() it. That means that if the underlying
* block is reallocated in ext4_get_block(),
* unmap_underlying_metadata() will find this block
* and will try to get rid of it. damn, damn.
*
* If this block has already been committed to the
* journal, a revoke record will be written. And
* revoke records must be emitted *before* clearing
* this block's bit in the bitmaps.
*/
ext4_forget(handle, 1, inode, bh, bh->b_blocknr);

/*
* Everything below this this pointer has been
* released. Now let this top-of-subtree go.
Expand All @@ -4534,8 +4513,20 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
blocks_for_truncate(inode));
}

/*
* The forget flag here is critical because if
* we are journaling (and not doing data
* journaling), we have to make sure a revoke
* record is written to prevent the journal
* replay from overwriting the (former)
* indirect block if it gets reallocated as a
* data block. This must happen in the same
* transaction where the data blocks are
* actually freed.
*/
ext4_free_blocks(handle, inode, 0, nr, 1,
EXT4_FREE_BLOCKS_METADATA);
EXT4_FREE_BLOCKS_METADATA|
EXT4_FREE_BLOCKS_FORGET);

if (parent_bh) {
/*
Expand Down

0 comments on commit dc639c1

Please sign in to comment.