Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: erofs: remove rcu_read_lock() in erofs_try_to_free_cached_page

page_private(page) cannot be changed if page lock is taken.

Besides, the corresponding workgroup won't be freed
if the page is already protected by page lock, therefore
no need to take rcu read lock.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Gao Xiang and committed by
Greg Kroah-Hartman
047d4abc 62dc4597

+5 -11
+5 -11
drivers/staging/erofs/unzip_vle.c
··· 238 238 { 239 239 struct erofs_sb_info *const sbi = EROFS_SB(mapping->host->i_sb); 240 240 const unsigned int clusterpages = erofs_clusterpages(sbi); 241 - 242 - struct z_erofs_vle_workgroup *grp; 241 + struct z_erofs_vle_workgroup *const grp = (void *)page_private(page); 243 242 int ret = 0; /* 0 - busy */ 244 - 245 - /* prevent the workgroup from being freed */ 246 - rcu_read_lock(); 247 - grp = (void *)page_private(page); 248 243 249 244 if (erofs_workgroup_try_to_freeze(&grp->obj, 1)) { 250 245 unsigned int i; ··· 252 257 } 253 258 } 254 259 erofs_workgroup_unfreeze(&grp->obj, 1); 255 - } 256 - rcu_read_unlock(); 257 260 258 - if (ret) { 259 - ClearPagePrivate(page); 260 - put_page(page); 261 + if (ret) { 262 + ClearPagePrivate(page); 263 + put_page(page); 264 + } 261 265 } 262 266 return ret; 263 267 }