Commit 2fb42b11f61cbcef7dfc225c1d26c4511436583d

Authored by Adrian Hunter
Committed by Artem Bityutskiy
1 parent 16dfd804b4

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 <ext-adrian.hunter@nokia.com>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

... ... @@ -317,6 +317,8 @@
317 317 return 0;
318 318  
319 319 out_unlock:
  320 + if (err != -EAGAIN)
  321 + ubifs_ro_mode(c, err);
320 322 mutex_unlock(&c->log_mutex);
321 323 kfree(ref);
322 324 kfree(bud);