public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: linux-ext4@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Jan Kara <jack@suse.cz>,
	Pavel Machek <pavel@suse.cz>
Subject: [PATCH 1/2] ext2: Update also inode on disk when dir is IS_DIRSYNC
Date: Wed, 14 Jan 2009 16:12:27 +0100	[thread overview]
Message-ID: <1231945948-23676-1-git-send-email-jack@suse.cz> (raw)

We used to just write changed page for IS_DIRSYNC inodes. But we also have to
update directory inode itself just for the case that we've allocated a new
block and changed i_size.

Thanks to AKPM for spotting a serious bug in the original version of this
patch.

Signed-off-by: Jan Kara <jack@suse.cz>
CC: Pavel Machek <pavel@suse.cz>
---
 fs/ext2/dir.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 9a0fc40..2999d72 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -95,10 +95,13 @@ static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
 		mark_inode_dirty(dir);
 	}
 
-	if (IS_DIRSYNC(dir))
+	if (IS_DIRSYNC(dir)) {
 		err = write_one_page(page, 1);
-	else
+		if (!err)
+			err = ext2_sync_inode(dir);
+	} else {
 		unlock_page(page);
+	}
 
 	return err;
 }
-- 
1.6.0.2


             reply	other threads:[~2009-01-14 15:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 15:12 Jan Kara [this message]
2009-01-14 15:12 ` [PATCH 2/2] ext2: Add blk_issue_flush() to syncing paths Jan Kara
2009-01-14 17:35   ` Eric Sandeen
2009-01-14 17:40     ` Jan Kara
2009-01-14 17:47       ` Eric Sandeen
2009-01-14 18:18   ` Andrew Morton
2009-01-14 18:27     ` Pavel Machek
2009-01-14 22:04     ` Theodore Tso
2009-01-14 22:17       ` Andrew Morton
2009-01-14 22:09     ` Theodore Tso
2009-01-14 22:26       ` Andrew Morton

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=1231945948-23676-1-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    /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