aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/vfs.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-12-09 10:45:04 -0500
committerMiklos Szeredi <mszeredi@redhat.com>2016-12-09 10:45:04 -0500
commitfd4a0edf2a3d781c6ae07d2810776ce22302ee1c (patch)
tree4ccfd06bc5705bc2903667043e4f9fdadb568d1b /fs/nfsd/vfs.c
parent2a07a1f5abba308729bd082dce4d035365165d85 (diff)
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/nfsd/vfs.c')
-rw-r--r--fs/nfsd/vfs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 8ca642fe9b21..b854f02c1c36 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1451,7 +1451,6 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1451__be32 1451__be32
1452nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) 1452nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1453{ 1453{
1454 struct inode *inode;
1455 mm_segment_t oldfs; 1454 mm_segment_t oldfs;
1456 __be32 err; 1455 __be32 err;
1457 int host_err; 1456 int host_err;
@@ -1463,10 +1462,9 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1463 1462
1464 path.mnt = fhp->fh_export->ex_path.mnt; 1463 path.mnt = fhp->fh_export->ex_path.mnt;
1465 path.dentry = fhp->fh_dentry; 1464 path.dentry = fhp->fh_dentry;
1466 inode = d_inode(path.dentry);
1467 1465
1468 err = nfserr_inval; 1466 err = nfserr_inval;
1469 if (!inode->i_op->readlink) 1467 if (!d_is_symlink(path.dentry))
1470 goto out; 1468 goto out;
1471 1469
1472 touch_atime(&path); 1470 touch_atime(&path);
@@ -1475,7 +1473,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1475 */ 1473 */
1476 1474
1477 oldfs = get_fs(); set_fs(KERNEL_DS); 1475 oldfs = get_fs(); set_fs(KERNEL_DS);
1478 host_err = inode->i_op->readlink(path.dentry, (char __user *)buf, *lenp); 1476 host_err = vfs_readlink(path.dentry, (char __user *)buf, *lenp);
1479 set_fs(oldfs); 1477 set_fs(oldfs);
1480 1478
1481 if (host_err < 0) 1479 if (host_err < 0)