Whamcloud - gitweb
LU-11582 llite: protect reading inode->i_data.nrpages 81/33681/4
authorBobi Jam <bobijam@whamcloud.com>
Sun, 11 Nov 2018 08:41:21 +0000 (16:41 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 5 Jan 2019 06:51:56 +0000 (06:51 +0000)
commitd936fdca9e00e05cecd4b21c6e4bbbf7107dc9b4
treeade0344b108f65215b2a961a0a98720edbcd733e
parent51e962be60cf599ecf154ea3a6b1c0f9882daac2
LU-11582 llite: protect reading inode->i_data.nrpages

truncate_inode_pages() looks up pages in the radix tree without
lock, and could miss finding pages removed from the radix tree
by __remove_mapping(), so that after calling truncate_inode_pages()
we need to read the nrpages of the inode->i_data with the protection
of tree_lock.

Since it could still be in the race window of __remove_mapping()->
__delete_from_page_cache()->page_cache_tree_delte(), before the
nrpages being decreased.

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I44ba6bea3dec4f0a110d1ae2a749514ec7dd0d12
Reviewed-on: https://review.whamcloud.com/33681
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@gmail.com>
lustre/include/lustre_compat.h
lustre/llite/llite_lib.c