]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
UBIFS: ensure UBIFS switches to read-only on error
authorAdrian Hunter <ext-adrian.hunter@nokia.com>
Fri, 18 Jul 2008 14:56:37 +0000 (17:56 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 13 Aug 2008 08:24:00 +0000 (11:24 +0300)
UBI transparently handles write errors by automatically copying
and remapping the affected eraseblock. If UBI is unable to do
that, for example its pool of eraseblocks reserved for bad block
handling is empty, then the error is propagated to UBIFS. UBIFS
must protect the media from falling into an inconsistent state
by immediately switching to read-only mode. In the case of log
updates, this was not being done.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
fs/ubifs/log.c

index 36857b9ed59e089c793f26098aecf820275c6959..e14829e506934904bd5917b95dd55e602ecc63c1 100644 (file)
@@ -317,6 +317,8 @@ int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs)
        return 0;
 
 out_unlock:
+       if (err != -EAGAIN)
+               ubifs_ro_mode(c, err);
        mutex_unlock(&c->log_mutex);
        kfree(ref);
        kfree(bud);