ANDROID: vfs/ext4,f2fs: finish umount(2) in time with filesystem work
This patch changes umount(2) flow to wait for delayed fput/mntput. Meanwhile,
we can still see unclosed name spaces which can trigger filesystem panic due
to released device illustrated below. (i.e., ext4 with errors=panic)
So, it introduces fs->umount_end() to change filesystem behavior like
error=remount-ro in ext4.
WARN: DO NOT upstream!
This is only related to Android reboot procedure, and resolves the below
issue where a kernel panic happens when a living filesystem tries to access
dead block device after device_shutdown done by kernel_restart.
Term: namespace(mnt_get_count())
1. create_new_namespaces() creates ns1 and ns2,
/data(1) ns1(1) ns2(1)
| | |
---------------------
|
sb->s_active = 3
2. after binder_proc_clear_zombies() for ns2 and ns1 triggers
- delayed_fput()
- delayed_mntput_work(ns2)
/data(1) ns1(1)
| |
----------
|
sb->s_active = 2
3. umount() for /data is successed.
ns1(1)
|
sb->s_active = 1
4. device_shutdown() by init
5. - delayed_mntput_work(ns1)
- put_super(), since sb->s_active = 0
- -EIO
Bug: 63981945
Bug: 65481582
Bug: 72236603
Change-Id: I7db02f480cc839bf9c245e078164a8168ea0d88b
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
6 files changed