Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1271722
| From | Al Viro <viro@ZenIV.linux.org.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 08/10] teach page_get_link() to work in RCU mode |
| Date | 2015-11-18 00:10 +0100 |
| Message-ID | <qvXxT-36Y-1@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>
more or less along the lines of Neil's patchset, sans the insanity
around kmap().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/namei.c | 19 +++++++++++++------
fs/proc/self.c | 2 +-
fs/proc/thread_self.c | 2 +-
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 089c37f..76cc4a2 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4534,12 +4534,19 @@ const char *page_get_link(struct dentry *dentry, struct inode *inode,
struct page *page;
struct address_space *mapping = inode->i_mapping;
- if (!dentry)
- return ERR_PTR(-ECHILD);
-
- page = read_mapping_page(mapping, 0, NULL);
- if (IS_ERR(page))
- return (char*)page;
+ if (!dentry) {
+ page = find_get_page(mapping, 0);
+ if (!page)
+ return ERR_PTR(-ECHILD);
+ if (!PageUptodate(page)) {
+ put_page(page);
+ return ERR_PTR(-ECHILD);
+ }
+ } else {
+ page = read_mapping_page(mapping, 0, NULL);
+ if (IS_ERR(page))
+ return (char*)page;
+ }
*cookie = page;
BUG_ON(mapping_gfp_mask(mapping) & __GFP_HIGHMEM);
kaddr = page_address(page);
diff --git a/fs/proc/self.c b/fs/proc/self.c
index bc599fb..9dd0ae6 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -21,7 +21,7 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
static const char *proc_self_get_link(struct dentry *dentry,
struct inode *inode, void **cookie)
{
- struct pid_namespace *ns = dentry->d_sb->s_fs_info;
+ struct pid_namespace *ns = inode->i_sb->s_fs_info;
pid_t tgid = task_tgid_nr_ns(current, ns);
char *name;
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index 1c78507..50eef6f 100644
--- a/fs/proc/thread_self.c
+++ b/fs/proc/thread_self.c
@@ -22,7 +22,7 @@ static int proc_thread_self_readlink(struct dentry *dentry, char __user *buffer,
static const char *proc_thread_self_get_link(struct dentry *dentry,
struct inode *inode, void **cookie)
{
- struct pid_namespace *ns = dentry->d_sb->s_fs_info;
+ struct pid_namespace *ns = inode->i_sb->s_fs_info;
pid_t tgid = task_tgid_nr_ns(current, ns);
pid_t pid = task_pid_nr_ns(current, ns);
char *name;
--
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