UBIFS with NAND. Writing into the same page from two system processes

Hi. The following problem is obscured. Two system processes wants to erase/write the same block/pages. There is no sync issues at mtd and nand drivers. Requests are performed one by one. But sequence can be the following: erase, erase, write, write. For example first process writes 0xA5 pattern, The second - 0x5A.
As a result, two write, write requests will be successfully finished after two erase,erase. So, for each cell in NAND, FFFFFFFF will be changed into 01011010(5a). And, after second write - 01011010 plus 10100101(a) into 00000000. Since 0 is leaved as zero. But 0 cannot be 1 without erasing.
So, all data bytes became 0x00. All ECC bytes also mixed in the same way. As a result, uncorrectable errors in page immediately happened after reading.

I see here the problem in UBIFS which must handle requests to the same page and do not allow case like erase, erase, write,write. It should be erase,write, erase,write. Or etc
The problem obscured in OpenWrt-18 and OpenWrt-23

Thanks in advance

Are you experiencing a concrete issue with OpenWrt?
Or are you asking about general filesystem design practices?

1 Like

Concrete issue with openwrt in router. Sudden uncorrectable errors in page of block handled by ubi and ubifs. Although bitflips state in device is very good. Some 1bit errors only. So, we created the tests which use mtd tool to erase/write the partition with file-pattern. Executed in two instances and reproduced the sudden uncorrectable. But now, I am sure it was wrong test. We have the uncorr. errors from tests due to direct using mtd to access nand. Without ubifs. So need again try to figure out why we have sudden uncorr. errrors in ubi partition. Any ideas?