public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: cmm@us.ibm.com
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, sandeen@redhat.com
Subject: Re: [PATCH] ext4: Fix delalloc sync hang with journal lock inversion
Date: Thu, 22 May 2008 15:55:48 +0530	[thread overview]
Message-ID: <20080522102548.GB30056@skywalker> (raw)
In-Reply-To: <1211391859-17399-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

On Wed, May 21, 2008 at 11:14:17PM +0530, Aneesh Kumar K.V wrote:
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  fs/ext4/inode.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 46cc610..076d00f 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -1571,13 +1571,17 @@ static int ext4_da_writepages(struct address_space *mapping,
>  		 */
>  		if (wbc->nr_to_write > EXT4_MAX_WRITEBACK_PAGES)
>  			wbc->nr_to_write = EXT4_MAX_WRITEBACK_PAGES;
> -		to_write -= wbc->nr_to_write;
> 
> +		to_write -= wbc->nr_to_write;
>  		ret = mpage_da_writepages(mapping, wbc, ext4_da_get_block_write);
>  		ext4_journal_stop(handle);
> -		to_write +=wbc->nr_to_write;
> +		if (wbc->nr_to_write) {
> +			/* We failed to write what we requested for */
> +			to_write += wbc->nr_to_write;
> +			break;
> +		}
> +		wbc->nr_to_write = to_write;
>  	}
> -
>  out_writepages:
>  	wbc->nr_to_write = to_write;
>  	wbc->range_cyclic = range_cyclic;

We need related fix for ext4_da_writepage. We need to allocate blocks in
ext4_da_writepage and we are called with page_lock. The handle
will be NULL in the below case and that would result in
ext4_get_block starting a new transaction when allocating blocks.


static int __ext4_da_writepage(struct page *page,
				struct writeback_control *wbc)
{
	struct inode *inode = page->mapping->host;
	handle_t *handle = NULL;
	int ret = 0;

	handle = ext4_journal_current_handle();

	if (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode))
		ret = nobh_writepage(page, ext4_get_block, wbc);
	else
		ret = block_write_full_page(page, ext4_get_block, wbc);

	if (!ret && inode->i_size > EXT4_I(inode)->i_disksize) {
		EXT4_I(inode)->i_disksize = inode->i_size;
		ext4_mark_inode_dirty(handle, inode);
	}

	return ret;
}

-aneesh

  parent reply	other threads:[~2008-05-22 10:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-21 17:44 delalloc and journal locking order inversion fixes Aneesh Kumar K.V
2008-05-21 17:44 ` [PATCH] ext4: Add validation to jbd lock inversion patch and split and writepage Aneesh Kumar K.V
2008-05-21 17:44   ` [PATCH] ext4: inverse locking ordering of page_lock and transaction start in delalloc Aneesh Kumar K.V
2008-05-21 17:44     ` [PATCH] ext4: Fix delalloc sync hang with journal lock inversion Aneesh Kumar K.V
2008-05-21 17:44       ` [PATCH] ext4: Inverse locking order of page_lock and transaction start Aneesh Kumar K.V
2008-05-21 17:44         ` [PATCH] ext4: Use page_mkwrite vma_operations to get mmap write notification Aneesh Kumar K.V
2008-05-22 10:25       ` Aneesh Kumar K.V [this message]
2008-05-22 17:58         ` [PATCH] ext4: Fix delalloc sync hang with journal lock inversion Mingming
2008-05-22 18:23           ` Aneesh Kumar K.V
2008-05-22 19:45             ` Mingming
2008-05-22 18:10       ` Mingming
2008-05-22 18:26         ` Aneesh Kumar K.V
2008-05-22 19:26           ` Mingming
  -- strict thread matches above, loose matches on Subject: below --
2008-05-30 13:39 [PATCH -v2] delalloc and journal locking order inversion fixes Aneesh Kumar K.V
2008-05-30 13:39 ` [PATCH] ext4: Use page_mkwrite vma_operations to get mmap write notification Aneesh Kumar K.V
2008-05-30 13:39   ` [PATCH] ext4: Inverse locking order of page_lock and transaction start Aneesh Kumar K.V
2008-05-30 13:39     ` [PATCH] vfs: Move mark_inode_dirty() from under page lock in generic_write_end() Aneesh Kumar K.V
2008-05-30 13:39       ` [PATCH] ext4: Add validation to jbd lock inversion patch and split and writepage Aneesh Kumar K.V
2008-05-30 13:39         ` [PATCH] ext4: inverse locking ordering of page_lock and transaction start in delalloc Aneesh Kumar K.V
2008-05-30 13:39           ` [PATCH] ext4: Fix delalloc sync hang with journal lock inversion Aneesh Kumar K.V
2008-06-02  9:35             ` Jan Kara
2008-06-02  9:59               ` Aneesh Kumar K.V
2008-06-02 10:27                 ` Jan Kara
2008-06-05 13:54                   ` Aneesh Kumar K.V
2008-06-05 16:22                     ` Jan Kara
2008-06-05 19:19                       ` Aneesh Kumar K.V
2008-06-11 12:41                         ` Jan Kara
2008-06-11 13:56                           ` Aneesh Kumar K.V
2008-06-11 17:48                             ` Jan Kara
2008-06-12 23:10                             ` Mingming Cao
2008-06-06 18:24 Patches for the patchqueue Aneesh Kumar K.V
2008-06-06 18:24 ` [PATCH] ext4: cleanup blockallocator Aneesh Kumar K.V
2008-06-06 18:24   ` [PATCH] ext2: Use page_mkwrite vma_operations to get mmap write notification Aneesh Kumar K.V
2008-06-06 18:24     ` [PATCH] ext3: " Aneesh Kumar K.V
2008-06-06 18:24       ` [PATCH] vfs: Don't flush delay buffer to disk Aneesh Kumar K.V
2008-06-06 18:24         ` [PATCH] mm: Add range_cont mode for writeback Aneesh Kumar K.V
2008-06-06 18:24           ` [PATCH] ext4: Fix delalloc sync hang with journal lock inversion Aneesh Kumar K.V

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=20080522102548.GB30056@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox