[PATCH 0/2] ubifs: respect dirty_writeback_interval

Rafał Miłecki zajec5 at gmail.com
Fri Sep 16 07:43:58 PDT 2016


On 16 September 2016 at 15:53, Richard Weinberger <richard at nod.at> wrote:
> On 14.09.2016 12:21, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal at milecki.pl>
>>
>> Hi,
>>
>> This patchset allows some ubifs adjustments that we realized we needed
>> in LEDE project.
>>
>> LEDE can be unstable on power cuts when installed on NAND devices (with
>> ubifs). This is caused by the default high value of wbuf timeout used by
>> ubifs. Any write that isn't followed by fsync (this may happen with
>> buggy user space app or just shell script) may be lost if power cut
>> happens in less than 5 seconds.
>>
>> One idea for fixing this (without modifying kernel at all) is to mount
>> ubifs with -o sync. This could affect NAND performance however, so I'm
>> looking for a better solution.
>>
>> During IRC discussion MTD guys suggested lowering wbuf timeout and I
>> decided to give it a try. The simplest way to do that seems to be making
>> ubifs respect dirty_writeback_interval. This parameter can be easily set
>> with sysctl and is already used in some older file systems.
>>
>> What do you think about this? I gave it a try with a simple
>> uci commit foo; sleep 1s; POWER_CUT
>> and it works as expected.
>
> I think it is correct to tie the wbuf timeout to dirty_writeback_interval.
> Especially since jffs2 does the same.
> Please address the comments Boris raised. Then we can get this merged.
>
> On the other hand, IMHO you will abuse this feature.
> If your uci tool does not correctly fsync()/fdatasync() it is just broken and
> needs fixing. Full stop.
> Lowering the wbut timeout reduces the chance to lose unsynced data but it
> won't fix the root cause. Users that face random power cuts will still have a
> chance to lose data. Boris also pointed that out on IRC.

It was Felix who said we don't need to fix uci after all, but I'll try
to smuggle patch for it anyway. I hope Felix will consider it
noninvasive and maybe accept it.

For me it's more about other (broken) user space apps that users may
use but obviously we can't test them all.

I'll obviously update patch after Boris's comments, I was just waiting
to see if there will be any others. Thanks.

-- 
Rafał



More information about the linux-mtd mailing list