From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu
Subject: [PATCH 1/2] ext4: Do not allow retry alloc loop under open transaction
Date: Wed, 03 Feb 2010 21:27:31 +0300 [thread overview]
Message-ID: <874olytbpe.fsf@openvz.org> (raw)
Some times we call ->write_begin() with opened journal
but write_begin() may internally call ext4_should_retry_alloc()
in case of ENOSPC, which result in deadlock.
This patch introduce new AOP_FLAG which should be tested on retry
alloc path.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ext4/ext4.h | 5 +++++
fs/ext4/inode.c | 6 ++++--
fs/ext4/move_extent.c | 2 +-
include/linux/fs.h | 1 +
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index af7b626..0efb224 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -792,6 +792,11 @@ struct ext4_inode_info {
#define EXT4_DFL_CHECKINTERVAL 0 /* Don't use interval check */
/*
+ * Address space flags.
+ */
+#define EXT4_AOP_FLAG_NORETRY AOP_FLAG_LAST /* Do not allow to fail in to
+ retry alloc loop */
+/*
* Behaviour when detecting errors
*/
#define EXT4_ERRORS_CONTINUE 1 /* Continue execution */
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c818972..2d3fe4d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1593,7 +1593,8 @@ retry:
}
}
- if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+ if (!(flags & EXT4_AOP_FLAG_NORETRY) && ret == -ENOSPC &&
+ ext4_should_retry_alloc(inode->i_sb, &retries))
goto retry;
out:
return ret;
@@ -3089,7 +3090,8 @@ retry:
ext4_truncate_failed_write(inode);
}
- if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+ if (!(flags & EXT4_AOP_FLAG_NORETRY) &&
+ ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
goto retry;
out:
return ret;
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 82c415b..f894382 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -796,7 +796,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
ext4_lblk_t orig_blk_offset;
long long offs = orig_page_offset << PAGE_CACHE_SHIFT;
unsigned long blocksize = orig_inode->i_sb->s_blocksize;
- unsigned int w_flags = 0;
+ unsigned int w_flags = EXT4_AOP_FLAG_NORETRY;
unsigned int tmp_data_size, data_size, replaced_size;
void *fsdata;
int i, jblocks;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b1bcb27..6f68707 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -504,6 +504,7 @@ enum positive_aop_returns {
#define AOP_FLAG_NOFS 0x0004 /* used by filesystem to direct
* helper code (eg buffer layer)
* to clear GFP_FS from alloc */
+#define AOP_FLAG_LAST 0x0008 /* First unused private flag */
/*
* oh the beauties of C type declarations.
--
1.6.3.3
next reply other threads:[~2010-02-03 18:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 18:27 Dmitry Monakhov [this message]
2010-02-04 11:37 ` [PATCH 1/2] ext4: Do not allow retry alloc loop under open transaction Aneesh Kumar K. V
2010-02-04 12:06 ` Dmitry Monakhov
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=874olytbpe.fsf@openvz.org \
--to=dmonakhov@openvz.org \
--cc=linux-ext4@vger.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).