Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1271724
| From | Al Viro <viro@ZenIV.linux.org.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 09/10] teach shmem_get_link() to work in RCU mode |
| Date | 2015-11-18 00:10 +0100 |
| Message-ID | <qvXxU-36Y-9@gated-at.bofh.it> (permalink) |
| References | <qvXoe-2MS-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
mm/shmem.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index e8220cf..e1ea5b5 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);
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHSET] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:00 +0100
[PATCH 08/10] teach page_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:10 +0100
[PATCH 09/10] teach shmem_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:10 +0100
[PATCH 01/10] switch befs long symlinks to page_symlink_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:10 +0100
[PATCH 10/10] teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:10 +0100
[PATCH 06/10] [vfs] don't put symlink bodies in pagecache into highmem Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:10 +0100
Re: [PATCH 06/10] [vfs] don't put symlink bodies in pagecache into highmem Dave Chinner <david@fromorbit.com> - 2015-11-20 00:10 +0100
[PATCH 05/10] namei: page_getlink() and page_follow_link_light() are the same thing Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:10 +0100
[PATCH 03/10] udf: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:10 +0100
[PATCH 04/10] ufs: get rid of ->setattr() for symlinks Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:10 +0100
[PATCH 02/10] logfs: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-18 00:10 +0100
csiph-web