From 69e75899f8394a0e45e98090bd57771405418eda Mon Sep 17 00:00:00 2001 From: Shiyong Li Date: Fri, 8 Dec 2017 17:30:22 -0800 Subject: [PATCH] fs/exfat: unlock pages under readonly status The ->writepage should unlock its page before returning the results. Otherwise, evict_inode can be hanged while truncating pages. - Backtrace - (__schedule+0x3dc/0x908) from [] (io_schedule+0x6c/0x94) (io_schedule+0x6c/0x94) from [] (sleep_on_page+0x8/0x10) (sleep_on_page+0x8/0x10) from [] (__wait_on_bit_lock+0x6c/0xb8) (__wait_on_bit_lock+0x6c/0xb8) from [] (__lock_page+0x90/0x98) (__lock_page+0x90/0x98) from [] (truncate_inode_pages_range+0x360/0x37c) (truncate_inode_pages_range+0x360/0x37c) from [] (truncate_inode_pages+0x18/0x20) (truncate_inode_pages+0x18/0x20) from [] (exfat_evict_inode+0x18/0xb0) (exfat_evict_inode+0x18/0xb0) from [] (evict+0x94/0x178) (evict+0x94/0x178) from [] (dispose_list+0x30/0x40) (dispose_list+0x30/0x40) from [] (evict_inodes+0xc8/0xd0) (evict_inodes+0xc8/0xd0) from [] (generic_shutdown_super+0x44/0xc4) (generic_shutdown_super+0x44/0xc4) from [] (kill_block_super+0x18/0x68) (kill_block_super+0x18/0x68) from [] (deactivate_locked_super+0x48/0x64) (deactivate_locked_super+0x48/0x64) from [] (SyS_umount+0x90/0x390) Change-Id: I0a9caebeceda503c72e365957b1bf97d74f3de89 Signed-off-by: Jaegeuk Kim Signed-off-by: Shiyong Li Reviewed-on: https://gerrit.mot.com/1102178 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Igor Kovalenko Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1276879 Reviewed-by: Hua Tan --- fs/exfat/exfat_super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/exfat/exfat_super.c b/fs/exfat/exfat_super.c index c2f636baffb8..da464a11474b 100644 --- a/fs/exfat/exfat_super.c +++ b/fs/exfat/exfat_super.c @@ -1617,8 +1617,11 @@ static int exfat_readpages(struct file *file, struct address_space *mapping, static int exfat_writepage(struct page *page, struct writeback_control *wbc) { - if (exfat_readonly(page->mapping->host->i_sb)) - return -EROFS; + if (exfat_readonly(page->mapping->host->i_sb)) { + unlock_page(page); + SetPageError(page); + return 0; + } return block_write_full_page(page, exfat_get_block, wbc); } -- 2.20.1