From: Adrian Hunter Date: Fri, 18 Jul 2008 14:56:37 +0000 (+0300) Subject: UBIFS: ensure UBIFS switches to read-only on error X-Git-Tag: v2.6.27-rc4~65^2~22 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fb42b11f61cbcef7dfc225c1d26c4511436583d;p=pandora-kernel.git UBIFS: ensure UBIFS switches to read-only on error 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 --- diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index 36857b9ed59e..e14829e50693 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c @@ -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);