ext4 Issue the discard operation *before* releasing the blocks to be
reused as we now support TRIM this can trigger.. svn path=/dists/sid/linux-2.6/; revision=15578
This commit is contained in:
parent
7e457be2c7
commit
eb763a85f0
|
@ -54,6 +54,8 @@ linux-2.6 (2.6.32-12) UNRELEASED; urgency=low
|
|||
* Backport KVM: Xen PV-on-HVM guest support.
|
||||
* Backport KVM: x86: Add KVM_GET/SET_VCPU_EVENTS. (closes: #578005)
|
||||
* hugetlb: fix infinite loop in get_futex_key() when backed by huge pages
|
||||
* ext4: Issue the discard operation *before* releasing the blocks to be
|
||||
reused.
|
||||
|
||||
[ dann frazier ]
|
||||
* Add DRBD backport
|
||||
|
|
62
debian/patches/bugfix/all/ext4-issue-discard-operation-before-releasing-blocks.patch
vendored
Normal file
62
debian/patches/bugfix/all/ext4-issue-discard-operation-before-releasing-blocks.patch
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
From: Theodore Ts'o <tytso@mit.edu>
|
||||
Date: Tue, 20 Apr 2010 20:51:59 +0000 (-0400)
|
||||
Subject: ext4: Issue the discard operation *before* releasing the blocks to be reused
|
||||
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=b90f687018e6d6c77d981b09203780f7001407e5
|
||||
|
||||
ext4: Issue the discard operation *before* releasing the blocks to be reused
|
||||
|
||||
[ backported to 2.6.3[23] ]
|
||||
|
||||
Otherwise, we can end up having data corruption because the blocks
|
||||
could get reused and then discarded!
|
||||
|
||||
https://bugzilla.kernel.org/show_bug.cgi?id=15579
|
||||
|
||||
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
|
||||
---
|
||||
|
||||
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
|
||||
index 54df209..e5ab41b 100644
|
||||
--- a/fs/ext4/mballoc.c
|
||||
+++ b/fs/ext4/mballoc.c
|
||||
@@ -2534,6 +2534,20 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
|
||||
mb_debug(1, "gonna free %u blocks in group %u (0x%p):",
|
||||
entry->count, entry->group, entry);
|
||||
|
||||
+ if (test_opt(sb, DISCARD)) {
|
||||
+ ext4_fsblk_t discard_block;
|
||||
+ struct ext4_super_block *es = EXT4_SB(sb)->s_es;
|
||||
+
|
||||
+ discard_block = (ext4_fsblk_t)entry->group *
|
||||
+ EXT4_BLOCKS_PER_GROUP(sb)
|
||||
+ + entry->start_blk
|
||||
+ + le32_to_cpu(es->s_first_data_block);
|
||||
+ trace_ext4_discard_blocks(sb,
|
||||
+ (unsigned long long)discard_block,
|
||||
+ entry->count);
|
||||
+ sb_issue_discard(sb, discard_block, entry->count);
|
||||
+ }
|
||||
+
|
||||
err = ext4_mb_load_buddy(sb, entry->group, &e4b);
|
||||
/* we expect to find existing buddy because it's pinned */
|
||||
BUG_ON(err != 0);
|
||||
@@ -2555,19 +2566,6 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
|
||||
page_cache_release(e4b.bd_bitmap_page);
|
||||
}
|
||||
ext4_unlock_group(sb, entry->group);
|
||||
- if (test_opt(sb, DISCARD)) {
|
||||
- ext4_fsblk_t discard_block;
|
||||
- struct ext4_super_block *es = EXT4_SB(sb)->s_es;
|
||||
-
|
||||
- discard_block = (ext4_fsblk_t)entry->group *
|
||||
- EXT4_BLOCKS_PER_GROUP(sb)
|
||||
- + entry->start_blk
|
||||
- + le32_to_cpu(es->s_first_data_block);
|
||||
- trace_ext4_discard_blocks(sb,
|
||||
- (unsigned long long)discard_block,
|
||||
- entry->count);
|
||||
- sb_issue_discard(sb, discard_block, entry->count);
|
||||
- }
|
||||
kmem_cache_free(ext4_free_ext_cachep, entry);
|
||||
ext4_mb_release_desc(&e4b);
|
||||
}
|
|
@ -54,4 +54,4 @@
|
|||
+ debian/sd-libata-set-capacity-abi-changes.patch
|
||||
+ bugfix/all/core-x86-make-list_poison-less-deadly.patch
|
||||
+ bugfix/all/hugetlb-fix-infinite-loop-in-get_futex_key-when-backed-by-huge-pages.patch
|
||||
|
||||
+ bugfix/all/ext4-issue-discard-operation-before-releasing-blocks.patch
|
||||
|
|
Loading…
Reference in New Issue