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>
This commit is contained in:
12
mm/shmem.c
12
mm/shmem.c
@@ -2496,10 +2496,14 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *shmem_follow_link(struct dentry *dentry, void **cookie)
|
||||
static const char *shmem_get_link(struct dentry *dentry,
|
||||
struct inode *inode, void **cookie)
|
||||
{
|
||||
struct page *page = NULL;
|
||||
int error = shmem_getpage(d_inode(dentry), 0, &page, SGP_READ, 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);
|
||||
@@ -2656,7 +2660,7 @@ static ssize_t shmem_listxattr(struct dentry *dentry, char *buffer, size_t size)
|
||||
|
||||
static const struct inode_operations shmem_short_symlink_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = simple_follow_link,
|
||||
.get_link = simple_get_link,
|
||||
#ifdef CONFIG_TMPFS_XATTR
|
||||
.setxattr = shmem_setxattr,
|
||||
.getxattr = shmem_getxattr,
|
||||
@@ -2667,7 +2671,7 @@ static const struct inode_operations shmem_short_symlink_operations = {
|
||||
|
||||
static const struct inode_operations shmem_symlink_inode_operations = {
|
||||
.readlink = generic_readlink,
|
||||
.follow_link = shmem_follow_link,
|
||||
.get_link = shmem_get_link,
|
||||
.put_link = shmem_put_link,
|
||||
#ifdef CONFIG_TMPFS_XATTR
|
||||
.setxattr = shmem_setxattr,
|
||||
|
Reference in New Issue
Block a user