diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-15 15:51:54 +0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-16 11:31:41 +0400 |
commit | cb14a18465686ea6add51b1008865b8174c28bd7 (patch) | |
tree | 9e1b7aa466e83c77628fa74af00049893db84c40 /fs/ubifs/gc.c | |
parent | c49139d8096dc1c392455dbc3f158b46038fc9d4 (diff) | |
download | linux-cb14a18465686ea6add51b1008865b8174c28bd7.tar.xz |
UBIFS: synchronize write-buffer before switching to the next bud
Currently when UBIFS fills up the current bud (which is the last in the journal
head) and switches to the next bud, it first writes the log reference node for
the next bud and only after this synchronizes the write-buffer of the previous
bud. This is not a big deal, but an unclean power cut may lead to a situation
when we have corruption in a next-to-last bud, although it is much more logical
that we have to have corruption only in the last bud.
This patch also removes write-buffer synchronization from
'ubifs_wbuf_seek_nolock()' because this is not needed anymore (we synchronize
the write-buffer explicitly everywhere now) and also because this is just
prone to various errors.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/gc.c')
-rw-r--r-- | fs/ubifs/gc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index d70937b3f8e9..ded29f6224c2 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -100,6 +100,10 @@ static int switch_gc_head(struct ubifs_info *c) if (err) return err; + err = ubifs_wbuf_sync_nolock(wbuf); + if (err) + return err; + err = ubifs_add_bud_to_log(c, GCHD, gc_lnum, 0); if (err) return err; |