From patchwork Fri Jan 28 17:13:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: ubifs_scan() error handling Date: Fri, 28 Jan 2011 07:13:20 -0000 From: twebb X-Patchwork-Id: 80875 Message-Id: To: dedekind1@gmail.com Cc: Lei Wen , linux-mtd@lists.infradead.org > On Tue, 2010-07-13 at 07:28 +0300, Artem Bityutskiy wrote: >> > Would it make sense and be acceptable to make this call any time >> > ubifs_scan() returns an error? >> >> May be. I'll think and return to you. > > We can probably go for it, but the current recovery is not enough for > MLC anyway. So I'd prefer to do the change you propose as a part of > larger UBIFS on MLC patch-set. > > Please, analyse ubifs_recover_leb(), find out what should be changed > there for MLC, send a patch-set. > It's been awhile but I wanted to reopen the discussion on this topic. Could you take a look at this proposed patch? Essentially this change results in the LEB being cleaned/recovered regardless of whether is_last_write() is true or not. There may be a better way to do this earlier in the same function, but I'm not familiar enough with it to know the significance of the is_last_write() call. diff -Naru a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c --- a/fs/ubifs/recovery.c 2011-01-26 16:08:04.000000000 -0500 +++ b/fs/ubifs/recovery.c 2011-01-26 16:08:25.000000000 -0500 @@ -665,19 +665,8 @@ } if (!empty_chkd && !is_empty(buf, len)) { - if (is_last_write(c, buf, offs)) { - clean_buf(c, &buf, lnum, &offs, &len); - need_clean = 1; - } else { - int corruption = first_non_ff(buf, len); - - ubifs_err("corrupt empty space LEB %d:%d, corruption " - "starts at %d", lnum, offs, corruption); - /* Make sure we dump interesting non-0xFF data */ - offs = corruption; - buf += corruption; - goto corrupted; - } + clean_buf(c, &buf, lnum, &offs, &len); + need_clean = 1; } /* Drop nodes from incomplete group */