[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20081103142706.92e3a2ae.akpm@linux-foundation.org>
Date: Mon, 3 Nov 2008 14:27:06 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Theodore Tso <tytso@....edu>
Cc: ajones@...erbed.com, sandeen@...hat.com,
linux-ext4@...r.kernel.org, sct@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext3: wait on all pending commits in ext3_sync_fs
On Mon, 3 Nov 2008 17:01:44 -0500
Theodore Tso <tytso@....edu> wrote:
> static int ext4_sync_fs(struct super_block *sb, int wait)
> {
> - tid_t target;
> + int ret;
>
> trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait);
> - sb->s_dirt = 0;
> - if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, &target)) {
> - if (wait)
> - jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, target);
> - }
> - return 0;
> + if (wait)
> + ret = ext4_force_commit(sb);
> + else
> + ret = jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL);
> + if (!ret)
> + sb->s_dirt = 0;
> + return ret;
> }
It should clear s_dirt before doing the "i/o", methinks?
The usual pattern is
foo->dirty = 0;
do_io_on(foo);
because
do_io_on(foo);
modify(foo);
foo->dirty = 1;
foo->dirty = 0;
is racy.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists