Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 90b65ff2 authored by Jan Kara's avatar Jan Kara Committed by Gerrit - the friendly Code Review server
Browse files

block: Fix oops in locked_inode_to_wb_and_lock_list()



When block device is closed, we call inode_detach_wb() in __blkdev_put()
which sets inode->i_wb to NULL. That is contrary to expectations that
inode->i_wb stays valid once set during the whole inode's lifetime and
leads to oops in wb_get() in locked_inode_to_wb_and_lock_list() because
inode_to_wb() returned NULL.

The reason why we called inode_detach_wb() is not valid anymore though.
BDI is guaranteed to stay along until we call bdi_put() from
bdev_evict_inode() so we can postpone calling inode_detach_wb() to that
moment.

Also add a warning to catch if someone uses inode_detach_wb() in a
dangerous way.

Change-Id: Idd7ddbc8120381b1649c4f82e2e8447c66b7ae4c
Reported-by: default avatarThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Git-commit: f759741d9d913eb57784a94b9bca78b376fc26a9
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git


Signed-off-by: default avatarRitesh Harjani <riteshh@codeaurora.org>
parent d8b63b69
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment