From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: djwong@us.ibm.com, Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH] libext2fs: fix BLOCK_ABORT handling in the block iterator for extents
Date: Wed, 15 Feb 2012 17:27:51 -0500 [thread overview]
Message-ID: <1329344871-16253-1-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <20120215222342.GB20023@thunk.org>
When processing files that contain extents, the block iterator
functions were not properly handling the BLOCK_ABORT bit. This could
cause problems such as ext2fs_link() adding a directory entry multiple
times.
Thanks to Darrick Wong <djwong@us.ibm.com> for reporting this.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
lib/ext2fs/block.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c
index 6a5c10d..85a1803 100644
--- a/lib/ext2fs/block.c
+++ b/lib/ext2fs/block.c
@@ -414,7 +414,7 @@ errcode_t ext2fs_block_iterate3(ext2_filsys fs,
0, 0, priv_data);
ret |= r;
check_for_ro_violation_goto(&ctx, ret,
- extent_errout);
+ extent_done);
if (r & BLOCK_CHANGED) {
ctx.errcode =
ext2fs_extent_set_bmap(handle,
@@ -448,6 +448,8 @@ errcode_t ext2fs_block_iterate3(ext2_filsys fs,
if (ctx.errcode)
break;
}
+ if (ret & BLOCK_ABORT)
+ break;
}
continue;
}
@@ -473,23 +475,23 @@ errcode_t ext2fs_block_iterate3(ext2_filsys fs,
0, 0, priv_data);
ret |= r;
check_for_ro_violation_goto(&ctx, ret,
- extent_errout);
+ extent_done);
if (r & BLOCK_CHANGED) {
ctx.errcode =
ext2fs_extent_set_bmap(handle,
(blk64_t) blockcnt,
new_blk, uninit);
if (ctx.errcode)
- goto extent_errout;
+ goto extent_done;
}
if (ret & BLOCK_ABORT)
- break;
+ goto extent_done;
}
}
- extent_errout:
+ extent_done:
ext2fs_extent_free(handle);
- ret |= BLOCK_ERROR | BLOCK_ABORT;
+ ret |= BLOCK_ERROR; /* ctx.errcode is always valid here */
goto errout;
}
--
1.7.9.107.g97f9a
prev parent reply other threads:[~2012-02-15 22:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-07 4:47 [PATCH] libext2fs: Only link an inode into a directory once Darrick J. Wong
2012-02-15 19:25 ` Ted Ts'o
2012-02-15 20:40 ` Darrick J. Wong
2012-02-15 22:23 ` Ted Ts'o
2012-02-15 22:27 ` Theodore Ts'o [this message]
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=1329344871-16253-1-git-send-email-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=djwong@us.ibm.com \
--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).