From: number9652 <number9652@yahoo.com>
To: Theodore Tso <tytso@mit.edu>, Eric Sandeen <sandeen@redhat.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] libext2fs: write only core inode in update_path()
Date: Wed, 17 Jun 2009 13:11:21 -0700 (PDT) [thread overview]
Message-ID: <494208.86194.qm@web43505.mail.sp1.yahoo.com> (raw)
--- On Wed, 6/17/09, Eric Sandeen wrote:
> Theodore Tso wrote:
> > Probably it would be better/simpler to replace this
> with:
> >
> > retval =
> ext2fs_write_inode(handle->fs, handle->ino,
> handle->inode);
> - Ted
> >
> Sure, that makes more sense, revised below:
>
> libext2fs: write only core inode in update_path()
>
> The ext2_extent_handle only has a struct ext2_inode
> allocated on
> it, and the same amount copied into it in that same
> function,
First, sorry for the original bug. I don't think the above is the right way to fix it, however. I am concerned that I may have basically broken write_inode_full on any inode with extents. For example, there is another call to write_inode_full in extent.c that might exhibit this same problem. I think the right fix would be to return to reading the full inode into memory in the extent_open function. See the patch below for what I am talking about.
libext2fs: read the full inode in extent_open2
The inode pointed to in the extent handle structure is expected to have the same size as the on-disk inode so the entire inode can be updated and written to disk, but in extent_open2, only 128 bytes was read into the inode, regardless of the on-disk inode size. Instead, read the entire inode.
Signed-off-by: Nic Case
---
diff --git a/e2fsprogs-1.41.6-orig/lib/ext2fs/extent.c b/e2fsprogs-1.41.6/lib/ext2fs/extent.c
index b7eb617..aebb9bc 100644
--- a/e2fsprogs-1.41.6-orig/lib/ext2fs/extent.c
+++ b/e2fsprogs-1.41.6/lib/ext2fs/extent.c
@@ -189,6 +189,7 @@ extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino,
{
struct ext2_extent_handle *handle;
errcode_t retval;
+ int isize = EXT2_INODE_SIZE(fs->super);
int i;
struct ext3_extent_header *eh;
@@ -203,7 +204,7 @@ extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino,
return retval;
memset(handle, 0, sizeof(struct ext2_extent_handle));
- retval = ext2fs_get_mem(sizeof(struct ext2_inode), &handle->inode);
+ retval = ext2fs_get_mem(isize, &handle->inode);
if (retval)
goto errout;
@@ -211,10 +212,10 @@ extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino,
handle->fs = fs;
if (inode) {
- memcpy(handle->inode, inode, sizeof(struct ext2_inode));
+ memcpy(handle->inode, inode, isize);
}
else {
- retval = ext2fs_read_inode(fs, ino, handle->inode);
+ retval = ext2fs_read_inode_full(fs, ino, handle->inode, isize);
if (retval)
goto errout;
}
---
next reply other threads:[~2009-06-17 20:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-17 20:11 number9652 [this message]
2009-06-17 20:43 ` [PATCH] libext2fs: write only core inode in update_path() Eric Sandeen
-- strict thread matches above, loose matches on Subject: below --
2009-06-17 21:32 number9652
2009-06-17 21:36 ` Eric Sandeen
2009-06-17 22:46 ` Theodore Tso
2009-06-16 22:38 Something wrong with extent-based journal creation Eric Sandeen
2009-06-17 0:57 ` [PATCH] libext2fs: write only core inode in update_path() Eric Sandeen
2009-06-17 15:35 ` Theodore Tso
2009-06-17 15:50 ` Eric Sandeen
2009-06-17 22:50 ` Theodore Tso
2009-06-17 23:00 ` Eric Sandeen
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=494208.86194.qm@web43505.mail.sp1.yahoo.com \
--to=number9652@yahoo.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--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).