ubifs: replay log error

Artem Bityutskiy dedekind1 at gmail.com
Sun Jun 29 07:14:05 PDT 2014


On Sun, 2014-06-29 at 16:39 +0300, Artem Bityutskiy wrote:
> On Thu, 2014-06-19 at 16:57 +0800, hujianyang wrote:
> > I found there might be a race in do_commit(). If we perform
> > ubifs_log_end_commit() before write master node, another
> > process which run ubifs_add_bud_to_log() may destroy the
> > old cs_node in the next or latter leb. Because log_end_commit()
> > will change @c->ltail_lnum by new @ltail_lnum. If power off
> > happens before we write either master node, we will read the
> > old master nodes and find no cs node exist in the leb which
> > master node indicate in the next mount.
> > 
> > Am I right?
> 
> Frankly, I did not fully understand your explanation, but after spending
> some time looking at the code and trying to recall what is going on
> there, I see the race condition.
> 
> Excellent analysis, well done, thank you!
> 
> > Now I would like to show the undone patch.
> 
> Not sure this patch is the best way to fix the issue.
> 
> How about the following patch (also attached), which I did not test, and
> did not even compile-check.

Scratch that, let me re-send patches which compile.

-- 
Best Regards,
Artem Bityutskiy




More information about the linux-mtd mailing list