rpms/kernel/devel linux-2.6-ext4-write-cyclic-fix.patch, NONE, 1.1 kernel.spec, 1.1298, 1.1299
Eric Sandeen
sandeen at fedoraproject.org
Sat Feb 14 23:14:48 UTC 2009
Author: sandeen
Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8220
Modified Files:
kernel.spec
Added Files:
linux-2.6-ext4-write-cyclic-fix.patch
Log Message:
* Sat Feb 14 2009 Eric Sandeen <sandeen at redhat.com>
- Fix ext4 hang on livecd-creator (#484522)
linux-2.6-ext4-write-cyclic-fix.patch:
--- NEW FILE linux-2.6-ext4-write-cyclic-fix.patch ---
ext4: Implement range_cyclic in ext4_da_writepages instead of write_cache_pages
From: "Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com>
With delayed allocation we lock the page in write_cache_pages() and
try to build an in memory extent of contiguous blocks. This is needed
so that we can get large contiguous blocks request. If range_cyclic
mode is enabled, write_cache_pages() will loop back to the 0 index if
no I/O has been done yet, and try to start writing from the beginning
of the range. That causes an attempt to take the page lock of lower
index page while holding the page lock of higher index page, which can
cause a dead lock with another writeback thread.
The solution is to implement the range_cyclic behavior in
ext4_da_writepages() instead.
http://bugzilla.kernel.org/show_bug.cgi?id=12579
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso at mit.edu>
---
fs/ext4/inode.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 658c4a7..cbd2ca9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2439,6 +2439,7 @@ static int ext4_da_writepages(struct address_space *mapping,
int no_nrwrite_index_update;
int pages_written = 0;
long pages_skipped;
+ int range_cyclic, cycled = 1, io_done = 0;
int needed_blocks, ret = 0, nr_to_writebump = 0;
struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
@@ -2490,9 +2491,15 @@ static int ext4_da_writepages(struct address_space *mapping,
if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
range_whole = 1;
- if (wbc->range_cyclic)
+ range_cyclic = wbc->range_cyclic;
+ if (wbc->range_cyclic) {
index = mapping->writeback_index;
- else
+ if (index)
+ cycled = 0;
+ wbc->range_start = index << PAGE_CACHE_SHIFT;
+ wbc->range_end = LLONG_MAX;
+ wbc->range_cyclic = 0;
+ } else
index = wbc->range_start >> PAGE_CACHE_SHIFT;
mpd.wbc = wbc;
@@ -2506,6 +2513,7 @@ static int ext4_da_writepages(struct address_space *mapping,
wbc->no_nrwrite_index_update = 1;
pages_skipped = wbc->pages_skipped;
+retry:
while (!ret && wbc->nr_to_write > 0) {
/*
@@ -2548,6 +2556,7 @@ static int ext4_da_writepages(struct address_space *mapping,
pages_written += mpd.pages_written;
wbc->pages_skipped = pages_skipped;
ret = 0;
+ io_done = 1;
} else if (wbc->nr_to_write)
/*
* There is no more writeout needed
@@ -2556,6 +2565,13 @@ static int ext4_da_writepages(struct address_space *mapping,
*/
break;
}
+ if (!io_done && !cycled) {
+ cycled = 1;
+ index = 0;
+ wbc->range_start = index << PAGE_CACHE_SHIFT;
+ wbc->range_end = mapping->writeback_index - 1;
+ goto retry;
+ }
if (pages_skipped != wbc->pages_skipped)
printk(KERN_EMERG "This should not happen leaving %s "
"with nr_to_write = %ld ret = %d\n",
@@ -2563,6 +2579,7 @@ static int ext4_da_writepages(struct address_space *mapping,
/* Update index */
index += pages_written;
+ wbc->range_cyclic = range_cyclic;
if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
/*
* set the writeback_index so that range_cyclic
Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1298
retrieving revision 1.1299
diff -u -r1.1298 -r1.1299
--- kernel.spec 14 Feb 2009 00:03:17 -0000 1.1298
+++ kernel.spec 14 Feb 2009 23:14:18 -0000 1.1299
@@ -622,6 +622,8 @@
Patch570: linux-2.6-selinux-mprotect-checks.patch
Patch580: linux-2.6-sparc-selinux-mprotect-checks.patch
+Patch590: linux-2.6-ext4-write-cyclic-fix.patch
+
Patch600: linux-2.6-defaults-alsa-hda-beep-off.patch
Patch670: linux-2.6-ata-quirk.patch
@@ -1055,6 +1057,7 @@
#
# ext4
+ApplyPatch linux-2.6-ext4-write-cyclic-fix.patch
# xfs
@@ -1748,6 +1751,9 @@
%kernel_variant_files -k vmlinux %{with_kdump} kdump
%changelog
+* Sat Feb 14 2009 Eric Sandeen <sandeen at redhat.com>
+- Fix ext4 hang on livecd-creator (#484522)
+
* Sat Feb 14 2009 David Woodhouse <David.Woodhouse at intel.com>
- Enable DMAR by default again now that it works
More information about the fedora-extras-commits
mailing list