android_kernel_xiaomi_sm8350/drivers/mtd/ubi
Artem Bityutskiy 43f9b25a9c UBI: bugfix: protect from volume removal
When the WL worker is moving an LEB, the volume might go away
occasionally. UBI does not handle these situations correctly.

This patch introduces a new mutex which serializes wear-levelling
worker and the the 'ubi_wl_put_peb()' function. Now, if one puts
an LEB, and its PEB is being moved, it will wait on the mutex.
And because we unmap all LEBs when removing volumes, this will make
the volume remove function to wait while the LEB movement
finishes.

Below is an example of an oops which should be fixed by this patch:

Pid: 9167, comm: io_paral Not tainted (2.6.24-rc5-ubi-2.6.git #2)
EIP: 0060:[<f884a379>] EFLAGS: 00010246 CPU: 0
EIP is at prot_tree_del+0x2a/0x63 [ubi]
EAX: f39a90e0 EBX: 00000000 ECX: 00000000 EDX: 00000134
ESI: f39a90e0 EDI: f39a90e0 EBP: f2d55ddc ESP: f2d55dd4
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process io_paral (pid: 9167, ti=f2d54000 task=f72a8030 task.ti=f2d54000)
Stack: f39a95f8 ef6aae50 f2d55e08 f884a511 f88538e1 f884ecea 00000134 00000000
       f39a9604 f39a95f0 efea8280 00000000 f39a90e0 f2d55e40 f8847261 f8850c3c
       f884eaad 00000001 000000b9 00000134 00000172 000000b9 00000134 00000001
Call Trace:
 [<c0105227>] show_trace_log_lvl+0x1a/0x30
 [<c01052e2>] show_stack_log_lvl+0xa5/0xca
 [<c01053d6>] show_registers+0xcf/0x21b
 [<c0105648>] die+0x126/0x224
 [<c0119a62>] do_page_fault+0x27f/0x60d
 [<c037dd62>] error_code+0x72/0x78
 [<f884a511>] ubi_wl_put_peb+0xf0/0x191 [ubi]
 [<f8847261>] ubi_eba_unmap_leb+0xaf/0xcc [ubi]
 [<f8843c21>] ubi_remove_volume+0x102/0x1e8 [ubi]
 [<f8846077>] ubi_cdev_ioctl+0x22a/0x383 [ubi]
 [<c017d768>] do_ioctl+0x68/0x71
 [<c017d7c6>] vfs_ioctl+0x55/0x271
 [<c017da15>] sys_ioctl+0x33/0x52
 [<c0104152>] sysenter_past_esp+0x5f/0xa5
 =======================

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:16 +02:00
..
build.c UBI: simplify error handling 2007-12-26 19:15:15 +02:00
cdev.c UBI: tweak volumes locking some more 2007-12-26 19:15:16 +02:00
debug.c UBI: use byte hexdump 2007-10-14 13:10:21 +03:00
debug.h UBI: add PID to debugging prints 2007-12-26 19:15:16 +02:00
eba.c UBI: bugfix: protect from volume removal 2007-12-26 19:15:16 +02:00
gluebi.c UBI: improve internal interfaces 2007-12-26 19:15:15 +02:00
io.c UBI: fix error code in ubi_io_read() 2007-12-26 19:15:13 +02:00
kapi.c UBI: introduce volume refcounting 2007-12-26 19:15:16 +02:00
Kconfig
Kconfig.debug
Makefile
misc.c UBI: improve internal interfaces 2007-12-26 19:15:15 +02:00
scan.c Merge branch 'master' of git://git.infradead.org/~dedekind/ubi-2.6 2007-10-14 14:29:00 +01:00
scan.h UBI: do not use vmalloc on I/O path 2007-10-14 13:10:21 +03:00
ubi.h UBI: bugfix: protect from volume removal 2007-12-26 19:15:16 +02:00
upd.c UBI: tweak volumes locking 2007-12-26 19:15:15 +02:00
vmt.c UBI: tweak volumes locking some more 2007-12-26 19:15:16 +02:00
vtbl.c UBI: introduce volume refcounting 2007-12-26 19:15:16 +02:00
wl.c UBI: bugfix: protect from volume removal 2007-12-26 19:15:16 +02:00