Skip to content

Commit

Permalink
ovl: use generic_readlink
Browse files Browse the repository at this point in the history
All filesystems that are backers for overlayfs would also use
generic_readlink().  Move this logic to the overlay itself, which is a nice
cleanup.

Signed-off-by: Miklos Szeredi <[email protected]>
  • Loading branch information
Miklos Szeredi committed Oct 14, 2016
1 parent cb348ed commit 78a3fa4
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions fs/overlayfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,25 +176,6 @@ static const char *ovl_get_link(struct dentry *dentry,
return p;
}

static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz)
{
struct path realpath;
struct inode *realinode;
const struct cred *old_cred;
int err;

ovl_path_real(dentry, &realpath);
realinode = realpath.dentry->d_inode;

if (!realinode->i_op->readlink)
return -EINVAL;

old_cred = ovl_override_creds(dentry->d_sb);
err = realinode->i_op->readlink(realpath.dentry, buf, bufsiz);
revert_creds(old_cred);
return err;
}

bool ovl_is_private_xattr(const char *name)
{
return strncmp(name, OVL_XATTR_PREFIX,
Expand Down Expand Up @@ -381,7 +362,7 @@ static const struct inode_operations ovl_file_inode_operations = {
static const struct inode_operations ovl_symlink_inode_operations = {
.setattr = ovl_setattr,
.get_link = ovl_get_link,
.readlink = ovl_readlink,
.readlink = generic_readlink,
.getattr = ovl_getattr,
.setxattr = generic_setxattr,
.getxattr = generic_getxattr,
Expand Down

0 comments on commit 78a3fa4

Please sign in to comment.