From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-ext4@vger.kernel.org
Cc: achender@linux.vnet.ibm.com, tytso@mit.edu,
Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH 1/7] ext4: Restore old EOFBLOCKS flag state after error
Date: Fri, 28 Oct 2011 21:00:04 +0400 [thread overview]
Message-ID: <1319821210-7374-2-git-send-email-dmonakhov@openvz.org> (raw)
In-Reply-To: <1319821210-7374-1-git-send-email-dmonakhov@openvz.org>
ext4_ext_insert_extent() may fail due to number of reasons (ENOSPC),
restore it's state before exit.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ext4/extents.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 61abc13..eae9680 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3723,6 +3723,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
ext4_fsblk_t newblock = 0;
int free_on_err = 0, err = 0, depth, ret;
+ int eof_fl = 0;
unsigned int allocated = 0, offset = 0;
unsigned int allocated_clusters = 0, reserved_clusters = 0;
unsigned int punched_out = 0;
@@ -4056,9 +4057,11 @@ got_allocated_blocks:
}
err = 0;
- if ((flags & EXT4_GET_BLOCKS_KEEP_SIZE) == 0)
+ if ((flags & EXT4_GET_BLOCKS_KEEP_SIZE) == 0) {
+ eof_fl = ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
err = check_eofblocks_fl(handle, inode, map->m_lblk,
path, ar.len);
+ }
if (!err)
err = ext4_ext_insert_extent(handle, inode, path,
&newex, flags);
@@ -4071,6 +4074,12 @@ got_allocated_blocks:
ext4_discard_preallocations(inode);
ext4_free_blocks(handle, inode, NULL, ext4_ext_pblock(&newex),
ext4_ext_get_actual_len(&newex), fb_flags);
+ /* Restore EOFBLOCKS flag state */
+ if (eof_fl &&
+ !ext4_test_inode_flag(inode, EXT4_INODE_EOFBLOCKS)) {
+ ext4_set_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
+ ext4_mark_inode_dirty(handle, inode);
+ }
goto out2;
}
--
1.7.1
next prev parent reply other threads:[~2011-10-28 17:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-28 17:00 [PATCH 0/7] ext4: cleanups and regression fixes for grow/shrink logic V3 Dmitry Monakhov
2011-10-28 17:00 ` Dmitry Monakhov [this message]
2011-10-28 17:00 ` [PATCH 2/7] ext4: move inode indepth shrink logic to didicated function Dmitry Monakhov
2011-10-28 17:00 ` [PATCH 3/7] ext4: Move punch hole " Dmitry Monakhov
2011-10-28 17:00 ` [PATCH 4/7] ext4: punch_hole fix extent conversion Dmitry Monakhov
2011-10-28 17:00 ` [PATCH 5/7] ext4: Update inode's transaction id after punch_hole Dmitry Monakhov
2011-10-28 17:00 ` [PATCH 6/7] ext4: punch hole should be restarted after transaction restart Dmitry Monakhov
2011-10-28 17:00 ` [PATCH 7/7] ext4: update EOFBLOCK flags after punch hole Dmitry Monakhov
2011-11-02 23:12 ` [PATCH 0/7] ext4: cleanups and regression fixes for grow/shrink logic V3 Allison Henderson
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=1319821210-7374-2-git-send-email-dmonakhov@openvz.org \
--to=dmonakhov@openvz.org \
--cc=achender@linux.vnet.ibm.com \
--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).