summaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-11-17 10:20:54 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-12-08 22:41:54 -0500
commit6b2553918d8b4e6de9853fd6315bec7271a2e592 (patch)
tree85540dcb0dc0de3d67c68d0aa7b17058f4e96539 /mm/shmem.c
parent21fc61c73c3903c4c312d0802da01ec2b323d174 (diff)
replace ->follow_link() with new method that could stay in RCU mode
new method: ->get_link(); replacement of ->follow_link(). The differences are: * inode and dentry are passed separately * might be called both in RCU and non-RCU mode; the former is indicated by passing it a NULL dentry. * when called that way it isn't allowed to block and should return ERR_PTR(-ECHILD) if it needs to be called in non-RCU mode. It's a flagday change - the old method is gone, all in-tree instances converted. Conversion isn't hard; said that, so far very few instances do not immediately bail out when called in RCU mode. That'll change in the next commits. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 64bf5acb49fe..684dbc32e233 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2496,10 +2496,14 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
2496 return 0; 2496 return 0;
2497} 2497}
2498 2498
2499static const char *shmem_follow_link(struct dentry *dentry, void **cookie) 2499static const char *shmem_get_link(struct dentry *dentry,
2500 struct inode *inode, void **cookie)
2500{ 2501{
2501 struct page *page = NULL; 2502 struct page *page = NULL;
2502 int error = shmem_getpage(d_inode(dentry), 0, &page, SGP_READ, NULL); 2503 int error;
2504 if (!dentry)
2505 return ERR_PTR(-ECHILD);
2506 error = shmem_getpage(inode, 0, &page, SGP_READ, NULL);
2503 if (error) 2507 if (error)
2504 return ERR_PTR(error); 2508 return ERR_PTR(error);
2505 unlock_page(page); 2509 unlock_page(page);
@@ -2656,7 +2660,7 @@ static ssize_t shmem_listxattr(struct dentry *dentry, char *buffer, size_t size)
2656 2660
2657static const struct inode_operations shmem_short_symlink_operations = { 2661static const struct inode_operations shmem_short_symlink_operations = {
2658 .readlink = generic_readlink, 2662 .readlink = generic_readlink,
2659 .follow_link = simple_follow_link, 2663 .get_link = simple_get_link,
2660#ifdef CONFIG_TMPFS_XATTR 2664#ifdef CONFIG_TMPFS_XATTR
2661 .setxattr = shmem_setxattr, 2665 .setxattr = shmem_setxattr,
2662 .getxattr = shmem_getxattr, 2666 .getxattr = shmem_getxattr,
@@ -2667,7 +2671,7 @@ static const struct inode_operations shmem_short_symlink_operations = {
2667 2671
2668static const struct inode_operations shmem_symlink_inode_operations = { 2672static const struct inode_operations shmem_symlink_inode_operations = {
2669 .readlink = generic_readlink, 2673 .readlink = generic_readlink,
2670 .follow_link = shmem_follow_link, 2674 .get_link = shmem_get_link,
2671 .put_link = shmem_put_link, 2675 .put_link = shmem_put_link,
2672#ifdef CONFIG_TMPFS_XATTR 2676#ifdef CONFIG_TMPFS_XATTR
2673 .setxattr = shmem_setxattr, 2677 .setxattr = shmem_setxattr,