• Rabin Vincent's avatar
    backing-dev: ensure wakeup_timer is deleted · 7a401a97
    Rabin Vincent authored
    bdi_prune_sb() in bdi_unregister() attempts to removes the bdi links
    from all super_blocks and then del_timer_sync() the writeback timer.
    
    However, this can race with __mark_inode_dirty(), leading to
    bdi_wakeup_thread_delayed() rearming the writeback timer on the bdi
    we're unregistering, after we've called del_timer_sync().
    
    This can end up with the bdi being freed with an active timer inside it,
    as in the case of the following dump after the removal of an SD card.
    
    Fix this by redoing the del_timer_sync() in bdi_destory().
    
     ------------[ cut here ]------------
     WARNING: at /home/rabin/kernel/arm/lib/debugobjects.c:262 debug_print_object+0x9c/0xc8()
     ODEBUG: free active (active state 0) object type: timer_list hint: wakeup_timer_fn+0x0/0x180
     Modules linked in:
     Backtrace:
     [<c00109dc>] (dump_backtrace+0x0/0x110) from [<c0236e4c>] (dump_stack+0x18/0x1c)
      r6:c02bc638 r5:00000106 r4:c79f5d18 r3:00000000
     [<c0236e34>] (dump_stack+0x0/0x1c) from [<c0025e6c>] (warn...
    7a401a97
backing-dev.c 22.2 KB