All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugme-daemon@bugzilla.kernel.org
To: linux-ext4@vger.kernel.org
Subject: [Bug 12579] ext4 filesystem hang
Date: Fri, 13 Feb 2009 03:50:48 -0800 (PST)	[thread overview]
Message-ID: <20090213115048.7233511D10A@picon.linux-foundation.org> (raw)
In-Reply-To: <bug-12579-13602@http.bugzilla.kernel.org/>

http://bugzilla.kernel.org/show_bug.cgi?id=12579





------- Comment #7 from aneesh.kumar@linux.vnet.ibm.com  2009-02-13 03:50 -------
How about the below patch ?

From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Subject: [PATCH] ext4: Don't use the range_cylic mode implemented by
write_cache_pages

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. Now with range_cyclic mode in
write_cache_pages
if we have not done an I/O we loop back to 0 index and try to write the page.
That would imply we will attempt to take page lock of lower index page holding
the page lock of higher index page. This can cause a dead lock with other
writeback
thread.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

---
 fs/ext4/inode.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 61e8fc0..f743524 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2437,6 +2437,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 = 0, 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);

@@ -2488,9 +2489,14 @@ 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)
+       if (wbc->range_cyclic) {
                index = mapping->writeback_index;
-       else
+               wbc->range_start = index << PAGE_CACHE_SHIFT;
+               wbc->range_end  = LLONG_MAX;
+               wbc->range_cyclic = 0;
+               range_cyclic = 1;
+               cycled = 0;
+       } else
                index = wbc->range_start >> PAGE_CACHE_SHIFT;

        mpd.wbc = wbc;
@@ -2504,6 +2510,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) {

                /*
@@ -2546,6 +2553,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
@@ -2554,6 +2562,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",
@@ -2561,6 +2576,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


-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

  parent reply	other threads:[~2009-02-13 11:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30  5:03 [Bug 12579] New: ext4 filesystem hang bugme-daemon
2009-02-12 15:24 ` [Bug 12579] " bugme-daemon
2009-02-12 16:36   ` Aneesh Kumar K.V
2009-02-12 17:49     ` Theodore Tso
2009-02-12 16:37 ` bugme-daemon
2009-02-12 16:44 ` bugme-daemon
2009-02-12 18:48 ` bugme-daemon
2009-02-12 18:55 ` bugme-daemon
2009-02-13  0:42 ` bugme-daemon
2009-02-13 11:49   ` Aneesh Kumar K.V
2009-02-13 11:50 ` bugme-daemon [this message]
2009-02-13 22:06 ` bugme-daemon
2009-02-14  1:50   ` Theodore Tso
2009-02-14  8:40     ` Aneesh Kumar K.V
2009-02-14  9:41       ` Aneesh Kumar K.V
2009-02-14  8:06   ` Aneesh Kumar K.V
2009-02-13 22:22 ` bugme-daemon
2009-02-14  2:07 ` bugme-daemon
2009-02-14  3:52 ` bugme-daemon
2009-02-14  8:07 ` bugme-daemon
2009-02-14  8:40 ` bugme-daemon
2009-02-14  9:42 ` bugme-daemon
2009-02-20  2:31 ` bugme-daemon
2009-02-21 17:35 ` bugme-daemon
2010-02-27 18:29 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090213115048.7233511D10A@picon.linux-foundation.org \
    --to=bugme-daemon@bugzilla.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.