[PATCH 05/17] bad_inode: use generic_readlink

From: Miklos Szeredi
Date: Mon Sep 12 2016 - 15:29:48 EST


This will allow us to move the generic readlink logic into the VFS and get
rid of the readlink method.

If inode has i_link set then this patch changes behavior, because
generic_readlink will return the cached contents instead of calling
i_op->get_link. It would be hard to imagine that this change could break
userspace in any sane setup, though.

Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxxxxx>
---
fs/bad_inode.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index b8db8531e837..7cf1f445fe04 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -78,12 +78,6 @@ static int bad_inode_rename2(struct inode *old_dir, struct dentry *old_dentry,
return -EIO;
}

-static int bad_inode_readlink(struct dentry *dentry, char __user *buffer,
- int buflen)
-{
- return -EIO;
-}
-
static int bad_inode_permission(struct inode *inode, int mask)
{
return -EIO;
@@ -178,7 +172,7 @@ static const struct inode_operations bad_inode_ops =
.rmdir = bad_inode_rmdir,
.mknod = bad_inode_mknod,
.rename2 = bad_inode_rename2,
- .readlink = bad_inode_readlink,
+ .readlink = generic_readlink,
.permission = bad_inode_permission,
.getattr = bad_inode_getattr,
.setattr = bad_inode_setattr,
--
2.5.5