From: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
To: bugzilla-daemon@bugzilla.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [Bug 15018] ext4 backtraces out of nowhere
Date: Wed, 20 Jan 2010 22:40:25 +0530 [thread overview]
Message-ID: <87iqawn1mm.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <201001182306.o0IN68F9004917@demeter.kernel.org>
On Mon, 18 Jan 2010 23:06:08 GMT, bugzilla-daemon@bugzilla.kernel.org wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=15018
>
>
> Jan Kara <jack@suse.cz> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |jack@suse.cz, tytso@mit.edu
>
>
>
>
> --- Comment #2 from Jan Kara <jack@suse.cz> 2010-01-18 23:06:07 ---
> Ah, inlining and such stuff made reading this stack trace quite difficult.
> Anyway, the problem is that we just should not call write_inode_now() in
> ext4_da_reserve_space() when we have transaction already started. And as
> Andreas correctly points out, the patch even introduces a deadlock because it
> can call write_inode_now with wait==1. Moreover we hold page lock when holding
> write_inode_now which introduces a plenty of nasty locking issues I believe.
> The bug has been introduced by commit 0637c6f4135f592f094207c7c21e7c0fc5557834.
>
> Ted, I think that if we are failing to do the write because of ENOSPC, the only
> reasonable non-deadlocky thing to do is to restart the write completely - i.e.,
> bail out up to ext4_da_write_begin, stop the transaction, drop the page, *do
> some magic*, and start again...
>
How about the below. I am yet to test the change
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c818972..5af483a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1835,24 +1835,12 @@ repeat:
* later. Real quota accounting is done at pages writeout
* time.
*/
- if (vfs_dq_reserve_block(inode, md_needed + 1)) {
- /*
- * We tend to badly over-estimate the amount of
- * metadata blocks which are needed, so if we have
- * reserved any metadata blocks, try to force out the
- * inode and see if we have any better luck.
- */
- if (md_reserved && retries++ <= 3)
- goto retry;
+ if (vfs_dq_reserve_block(inode, md_needed + 1))
return -EDQUOT;
- }
if (ext4_claim_free_blocks(sbi, md_needed + 1)) {
vfs_dq_release_reservation_block(inode, md_needed + 1);
if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
- retry:
- if (md_reserved)
- write_inode_now(inode, (retries == 3));
yield();
goto repeat;
}
@@ -3032,7 +3020,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
{
- int ret, retries = 0;
+ int ret, retries = 0, quota_retries = 0;
struct page *page;
pgoff_t index;
unsigned from, to;
@@ -3091,6 +3079,21 @@ retry:
if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
goto retry;
+
+ if ((ret == -EDQUOT) && (quota_retries <= 3)) {
+ /*
+ * Since we do aggressive quota reservation may get no quota error
+ * even though we may be having quota. Forcing the inode write will
+ * free up the extra quota reserved. We do it only if we have
+ * meta data blocks reserved because we do aggressive reservation only
+ * for meta data blocks.
+ */
+ if (EXT4_I(inode)->i_reserved_meta_blocks) {
+ write_inode_now(inode, (quota_retries == 3));
+ quota_retries++;
+ goto retry;
+ }
+ }
out:
return ret;
}
next prev parent reply other threads:[~2010-01-20 17:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-09 19:01 [Bug 15018] New: ext4 backtraces out of nowhere bugzilla-daemon
2010-01-10 10:45 ` Andreas Dilger
2010-01-10 10:46 ` [Bug 15018] " bugzilla-daemon
2010-01-18 23:06 ` bugzilla-daemon
2010-01-20 17:10 ` Aneesh Kumar K. V [this message]
2010-01-20 17:10 ` bugzilla-daemon
2010-01-26 23:19 ` bugzilla-daemon
2010-01-27 9:46 ` Aneesh Kumar K. V
2010-01-26 23:20 ` bugzilla-daemon
2010-01-27 9:46 ` bugzilla-daemon
2010-01-27 11:51 ` bugzilla-daemon
2010-03-18 11:11 ` 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=87iqawn1mm.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=bugzilla-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).