• A
    UBI: bugfix: protect from volume removal · 43f9b25a
    Artem Bityutskiy 提交于
    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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
    43f9b25a
wl.c 43.3 KB