Emergency synch/umount/shutdown of UBIFS on NAND

Mats Kärrman Mats.Karrman at tritech.se
Fri Jan 10 07:31:30 EST 2014


Hi Michel,

UBIFS has a debugfs knob to switch it into read-only mode, see
"dfs_ro_error" in fs/ubifs/debug.h. Maybe you could let your interrupt
handler trigger this?

Thinking about it, the ubi layer also has a background thread that may be
writing on it's own but the ubi_device struct (drivers/mtd/ubi/ubi.h) has a
ro_mode property...

I don't say it will work but maybe it's something worth checking out?

BR // Mats

________________________________________
From: linux-mtd [linux-mtd-bounces at lists.infradead.org] on behalf of Michel Benoit [michel at nube.nu]
Sent: Friday, January 10, 2014 9:44 AM
To: linux-mtd at lists.infradead.org
Subject: Emergency synch/umount/shutdown of UBIFS on NAND

Hello mtd-list,

We've got linux 3.10.x running on a custom board with Atmel
AT91SAM9X25 SoC and a 4Gb NAND from Micron (MT29F4G08ABADA).

The NAND is formatted with UBIFS partitions for rootfs and a user
disk. The rootfs disk is RO and the user disk partition is R/W.

The board is designed so that if the power supply suddenly drops the
CPU, RAM and NAND have ~50ms to perform an emergency shutdown.

What can the kernel do in 50ms that minimizes the risk for problems
with UBI, UBIFS and the NAND?

An interrupt input signal is activated when the voltage drops below
the critical level. Some options I have been considering are:

- kernelspace notifies userspace which umounts the ubifs partitions
- call sync() from kernelspace
- call emergency_sync() from kernelspace

The risk with these options is that there is no way to know if they
will complete i 50ms and they initiate activity on the NAND disk which
increases the risk that the NAND will be performing a program or erase
operation at the moment the power to CPU and NAND drop off after 50
ms.

What I really want to do is tell the system to complete any ongoing
program or erase operations that affect the NAND and then block all
other operations.

Is there support for this kind of emergency shutdown in UBIFS? Or does
that kind of shutdown belong at the MTD or NAND driver levels?

Any other tips for how to handle emergency shutdown are appreciated.

/Michel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



More information about the linux-mtd mailing list