Skip to content

Commit

Permalink
teach shmem_get_link() to work in RCU mode
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Dec 9, 2015
1 parent d3883d4 commit 6a6c990
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6a6c990

Please sign in to comment.