From: Eric Sandeen <sandeen@redhat.com>
To: Curt Wohlgemuth <curtw@google.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: sync the directory inode in ext4_sync_parent()
Date: Tue, 05 Apr 2011 12:35:38 -0700 [thread overview]
Message-ID: <4D9B6F0A.5080705@redhat.com> (raw)
In-Reply-To: <1302031663-13547-1-git-send-email-curtw@google.com>
On 4/5/11 12:27 PM, Curt Wohlgemuth wrote:
> ext4 has taken the stance that, in the absence of a journal,
> when an fsync/fdatasync of an inode is done, the parent
> directory should be sync'ed if this inode entry is new.
> ext4_sync_parent(), which implements this, does indeed sync
> the dirent pages for parent directories, but it does not
> sync the directory *inode*. This patch fixes this.
>
> I tested this using a power fail test, which panics a
> machine running a file server getting requests from a
> client. Without this patch, on about every other test run,
> the server is missing many, many files that had been synced.
> With this patch, on > 6 runs, I see zero files being lost.
>
> Signed-off-by: Curt Wohlgemuth <curtw@google.com>
> ---
> fs/ext4/fsync.c | 11 ++++++++++-
> 1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
> index 7f74019..a276348 100644
> --- a/fs/ext4/fsync.c
> +++ b/fs/ext4/fsync.c
> @@ -128,6 +128,7 @@ extern int ext4_flush_completed_IO(struct inode *inode)
> static void ext4_sync_parent(struct inode *inode)
> {
> struct dentry *dentry = NULL;
> + int ret;
>
> while (inode && ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY)) {
> ext4_clear_inode_state(inode, EXT4_STATE_NEWENTRY);
> @@ -136,7 +137,15 @@ static void ext4_sync_parent(struct inode *inode)
> if (!dentry || !dentry->d_parent || !dentry->d_parent->d_inode)
> break;
> inode = dentry->d_parent->d_inode;
> - sync_mapping_buffers(inode->i_mapping);
> + ret = sync_mapping_buffers(inode->i_mapping);
> + if (! ret) {
> + struct writeback_control wbc = {
> + .sync_mode = WB_SYNC_ALL,
> + .nr_to_write = 0, /* metadata-only; caller
> + takes care of data */
> + };
> + (void)sync_inode(inode, &wbc);
I know ext4_sync_parent was a void already, but why don't we send errors back up through ext4_sync_file?
-Eric
> + }
> }
> }
>
next prev parent reply other threads:[~2011-04-05 19:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 19:27 [PATCH] ext4: sync the directory inode in ext4_sync_parent() Curt Wohlgemuth
2011-04-05 19:35 ` Eric Sandeen [this message]
2011-04-05 19:43 ` Curt Wohlgemuth
2011-04-05 19:46 ` Eric Sandeen
-- strict thread matches above, loose matches on Subject: below --
2011-04-05 23:24 Curt Wohlgemuth
2011-04-06 21:01 ` Ted Ts'o
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=4D9B6F0A.5080705@redhat.com \
--to=sandeen@redhat.com \
--cc=curtw@google.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).