From: Jan Kara <jack@suse.cz>
To: stable@kernel.org
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu,
Dmitry Monakhov <dmonakhov@openvz.org>, Jan Kara <jack@suse.cz>
Subject: [PATCH 5/5] ext4: fix sleep inside spinlock issue with quota and dealloc (#14739)
Date: Wed, 23 Dec 2009 18:27:56 +0100 [thread overview]
Message-ID: <1261589276-1380-6-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1261589276-1380-1-git-send-email-jack@suse.cz>
From: Dmitry Monakhov <dmonakhov@openvz.org>
Unlock i_block_reservation_lock before vfs_dq_reserve_block().
This patch fixes http://bugzilla.kernel.org/show_bug.cgi?id=14739
CC: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/inode.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9307f4b..6b7735f 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1764,19 +1764,17 @@ repeat:
md_needed = mdblocks - EXT4_I(inode)->i_reserved_meta_blocks;
total = md_needed + nrblocks;
+ spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
/*
* Make quota reservation here to prevent quota overflow
* later. Real quota accounting is done at pages writeout
* time.
*/
- if (vfs_dq_reserve_block(inode, total)) {
- spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
+ if (vfs_dq_reserve_block(inode, total))
return -EDQUOT;
- }
if (ext4_claim_free_blocks(sbi, total)) {
- spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
yield();
goto repeat;
@@ -1784,10 +1782,11 @@ repeat:
vfs_dq_release_reservation_block(inode, total);
return -ENOSPC;
}
+ spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
EXT4_I(inode)->i_reserved_data_blocks += nrblocks;
- EXT4_I(inode)->i_reserved_meta_blocks = mdblocks;
next prev parent reply other threads:[~2009-12-23 17:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-23 17:27 [PATCH 0/5] Ext4 quota fixes for 2.6.31 kernel Jan Kara
2009-12-23 17:27 ` [PATCH 1/5] Add unlocked version of inode_add_bytes() function Jan Kara
2009-12-23 17:27 ` [PATCH 2/5] quota: decouple fs reserved space from quota reservation Jan Kara
2010-01-11 17:53 ` Eric Sandeen
2010-01-11 18:00 ` Jan Kara
2009-12-23 17:27 ` [PATCH 3/5] ext4: Convert to generic reserved quota's space management Jan Kara
2009-12-23 17:27 ` [PATCH 4/5] ext4: Fix potential quota deadlock Jan Kara
2009-12-23 17:27 ` Jan Kara [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-12-23 17:25 [PATCH 0/5] Ext4 quota fixes for 2.6.32 -stable kernel Jan Kara
2009-12-23 17:25 ` [PATCH 5/5] ext4: fix sleep inside spinlock issue with quota and dealloc (#14739) Jan Kara
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=1261589276-1380-6-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=dmonakhov@openvz.org \
--cc=linux-ext4@vger.kernel.org \
--cc=stable@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).