ext4: fix panic on module unload when stopping lazyinit thread
authorEric Sandeen <sandeen@redhat.com>
Thu, 3 Feb 2011 19:33:15 +0000 (14:33 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 3 Feb 2011 19:33:15 +0000 (14:33 -0500)
commit8f1f745331c1b560f53c0d60e55a4f4f43f7cce5
treed8db8e0e1a067012795372e38fce09dec6bc575a
parent1bae4ce27c9c90344f23c65ea6966c50ffeae2f5
ext4: fix panic on module unload when stopping lazyinit thread

https://bugzilla.kernel.org/show_bug.cgi?id=27652

If the lazyinit thread is running, the teardown function
ext4_destroy_lazyinit_thread() has problems:

        ext4_clear_request_list();
        while (ext4_li_info->li_task) {
                wake_up(&ext4_li_info->li_wait_daemon);
                wait_event(ext4_li_info->li_wait_task,
                           ext4_li_info->li_task == NULL);
        }

Clearing the request list will cause the thread to exit and free
ext4_li_info, so then we're waiting on something which is getting
freed.

Fix this up by making the thread respond to kthread_stop, and exit,
without the need to wait for that exit in some other homegrown way.

Cc: stable@kernel.org
Reported-and-Tested-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/super.c