summaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-11-17 10:54:32 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-12-08 22:41:55 -0500
commit6a6c99049635473b64c384135a6906a10df2c916 (patch)
tree6ecb841fe51e0643f37db146f14f374a9470a21e /mm/shmem.c
parentd3883d4f93449343be6296e2274360db39b6842a (diff)
downloadop-kernel-dev-6a6c99049635473b64c384135a6906a10df2c916.zip
op-kernel-dev-6a6c99049635473b64c384135a6906a10df2c916.tar.gz
teach shmem_get_link() to work in RCU mode
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 684dbc3..0605716 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2501,12 +2501,20 @@ static const char *shmem_get_link(struct dentry *dentry,
{
struct page *page = NULL;
int error;
- if (!dentry)
- return ERR_PTR(-ECHILD);
- error = shmem_getpage(inode, 0, &page, SGP_READ, NULL);
- if (error)
- return ERR_PTR(error);
- unlock_page(page);
+ if (!dentry) {
+ page = find_get_page(inode->i_mapping, 0);
+ if (!page)
+ return ERR_PTR(-ECHILD);
+ if (!PageUptodate(page)) {
+ put_page(page);
+ return ERR_PTR(-ECHILD);
+ }
+ } else {
+ error = shmem_getpage(inode, 0, &page, SGP_READ, NULL);
+ if (error)
+ return ERR_PTR(error);
+ unlock_page(page);
+ }
*cookie = page;
return page_address(page);
}
OpenPOWER on IntegriCloud