summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorGao Xiang <gaoxiang25@huawei.com>2019-02-16 16:46:50 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-20 11:20:55 +0100
commit047d4abc4df740d48e0386ecc7d52f6d312187af (patch)
tree2fc951253a5a49101c2f01e70d345c3733314501 /drivers
parent62dc45979f3f8cb0ea67302a93bff686f0c46c5a (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/erofs/unzip_vle.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
index 2b5951f233db..a127d8db76d8 100644
--- a/drivers/staging/erofs/unzip_vle.c
+++ b/drivers/staging/erofs/unzip_vle.c
@@ -238,14 +238,9 @@ int erofs_try_to_free_cached_page(struct address_space *mapping,
{
struct erofs_sb_info *const sbi = EROFS_SB(mapping->host->i_sb);
const unsigned int clusterpages = erofs_clusterpages(sbi);
-
- struct z_erofs_vle_workgroup *grp;
+ struct z_erofs_vle_workgroup *const grp = (void *)page_private(page);
int ret = 0; /* 0 - busy */
- /* prevent the workgroup from being freed */
- rcu_read_lock();
- grp = (void *)page_private(page);
-
if (erofs_workgroup_try_to_freeze(&grp->obj, 1)) {
unsigned int i;
@@ -257,12 +252,11 @@ int erofs_try_to_free_cached_page(struct address_space *mapping,
}
}
erofs_workgroup_unfreeze(&grp->obj, 1);
- }
- rcu_read_unlock();
- if (ret) {
- ClearPagePrivate(page);
- put_page(page);
+ if (ret) {
+ ClearPagePrivate(page);
+ put_page(page);
+ }
}
return ret;
}