summaryrefslogtreecommitdiff
path: root/fs/stat.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-12-09 16:45:04 +0100
committerMiklos Szeredi <mszeredi@redhat.com>2016-12-09 16:45:04 +0100
commitfd4a0edf2a3d781c6ae07d2810776ce22302ee1c (patch)
tree4ccfd06bc5705bc2903667043e4f9fdadb568d1b /fs/stat.c
parent2a07a1f5abba308729bd082dce4d035365165d85 (diff)
downloadlwn-fd4a0edf2a3d781c6ae07d2810776ce22302ee1c.tar.gz
lwn-fd4a0edf2a3d781c6ae07d2810776ce22302ee1c.zip
vfs: replace calling i_op->readlink with vfs_readlink()
Also check d_is_symlink() in callers instead of inode->i_op->readlink because following patches will allow NULL ->readlink for symlinks. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/stat.c')
-rw-r--r--fs/stat.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/stat.c b/fs/stat.c
index bc045c7994e1..0b210c3ead5c 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -329,12 +329,14 @@ retry:
struct inode *inode = d_backing_inode(path.dentry);
error = empty ? -ENOENT : -EINVAL;
- if (inode->i_op->readlink) {
+ /*
+ * AFS mountpoints allow readlink(2) but are not symlinks
+ */
+ if (d_is_symlink(path.dentry) || inode->i_op->readlink) {
error = security_inode_readlink(path.dentry);
if (!error) {
touch_atime(&path);
- error = inode->i_op->readlink(path.dentry,
- buf, bufsiz);
+ error = vfs_readlink(path.dentry, buf, bufsiz);
}
}
path_put(&path);