Whamcloud - gitweb
LU-11582 llite: protect reading inode->i_data.nrpages 39/33639/3
authorBobi Jam <bobijam@whamcloud.com>
Sun, 11 Nov 2018 08:41:21 +0000 (16:41 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 27 Nov 2018 04:56:35 +0000 (04:56 +0000)
commit04c172b686763be0d42eb4c36532d5795166eb7c
tree7e8df41651cb0c347654700e0b1f2dd0c5737a81
parent76b9eecdebf830606b021079148eaefa6aab99cc
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/33639
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/include/lustre_compat.h
lustre/llite/llite_lib.c