[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120111121022.GB26337@quack.suse.cz>
Date: Wed, 11 Jan 2012 13:10:22 +0100
From: Jan Kara <jack@...e.cz>
To: Surbhi Palande <csurbhi@...il.com>
Cc: Jan Kara <jack@...e.cz>, Eric Sandeen <sandeen@...deen.net>,
Kamal Mostafa <kamal@...onical.com>,
Andreas Dilger <adilger.kernel@...ger.ca>,
Randy Dunlap <rdunlap@...otime.net>,
Theodore Tso <tytso@....edu>, linux-ext4@...r.kernel.org,
Valerie Aurora <val@...consulting.com>,
Christopher Chaltain <christopher.chaltain@...onical.com>,
"Peter M. Petrakis" <peter.petrakis@...onical.com>,
Mikulas Patocka <mpatocka@...hat.com>
Subject: Re: [PATCH v2 1/7] Adding support to freeze and unfreeze a journal
On Tue 10-01-12 21:38:29, Surbhi Palande wrote:
> On second thoughts, I fail to see why there is still a race window
> after this patch.
>
> Here are the reasons why i fail to see how the data can be dirtied
> when all the operations involve a journal:
>
> ----------
> So here is the problem that we see
> CPU1 CPU2
> Task1 (write operation) Task2
> ---------------------------------------------------------------------------------------
> t1 ext4_journal_start()
> t2 ext4_journal_start_sb()
> t3 vfs_check_frozen sb->frozen=SB_FREEZE_WRITE
> t4 jbd2_journal_start() /* hence forth all processes calling
> vfs_check_frozen will wait */
Note that we call vfs_check_frozen(sb, SB_FREEZE_TRANS) in
ext4_journal_start_sb(). Thus we start blocking only when s_frozen ==
SB_FREEZE_TRANS and we just ignore s_frozen == SB_FREEZE_WRITE.
> Now, our aim is to stop Task1 from dirtying the page cache ie in
> starting this transaction. However if it is successful in starting
> this transaction, then we want to make sure that this transaction is
> flushed out.
> Correct?
Not quite. Flushing a journal will flush dirty metadata but we will still
have dirty pages (dirty data is not part of any transaction). So in the
scenarion I describe in
http://marc.info/?l=linux-fsdevel&m=132585911925796&w=2
all metadata changes will be flushed inside ->freeze_fs (at least for
journalling filesystems) but pages will be left dirty. Is it clearer now?
But your comment makes me realize that the situation is simpler than I
thought by the fact that we only have to protect paths that create dirty
data as dirty metadata can be handled by flushing a journal. And there are
only a few places creating dirty data. So a reasonably clean solution
shouldn't be that complicated after all. I'll tweak my patch and try it in
a moment.
Honza
--
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists