2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-16 01:04:08 +08:00

teach shmem_get_link() to work in RCU mode

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2015-11-17 10:54:32 -05:00
parent d3883d4f93
commit 6a6c990496

View File

@ -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);
}