summaryrefslogtreecommitdiffstats
path: root/fs/sysv/symlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysv/symlink.c')
-rw-r--r--fs/sysv/symlink.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/sysv/symlink.c b/fs/sysv/symlink.c
index 4e8a5e349..d76c3fa66 100644
--- a/fs/sysv/symlink.c
+++ b/fs/sysv/symlink.c
@@ -21,6 +21,7 @@
#include <asm/uaccess.h>
static int sysv_readlink(struct inode *, char *, int);
+static struct dentry *sysv_follow_link(struct inode *, struct dentry *);
/*
* symlinks can't do much...
@@ -37,6 +38,7 @@ struct inode_operations sysv_symlink_inode_operations = {
NULL, /* mknod */
NULL, /* rename */
sysv_readlink, /* readlink */
+ sysv_follow_link, /* follow_link */
NULL, /* readpage */
NULL, /* writepage */
NULL, /* bmap */
@@ -44,6 +46,21 @@ struct inode_operations sysv_symlink_inode_operations = {
NULL /* permission */
};
+static struct dentry *sysv_follow_link(struct inode * inode, struct dentry * base)
+{
+ struct buffer_head * bh;
+
+ bh = sysv_file_bread(inode, 0, 0);
+ if (!bh) {
+ dput(base);
+ return ERR_PTR(-EIO);
+ }
+ UPDATE_ATIME(inode);
+ base = lookup_dentry(bh->b_data, base, 1);
+ brelse(bh);
+ return base;
+}
+
static int sysv_readlink(struct inode * inode, char * buffer, int buflen)
{
struct buffer_head * bh;
@@ -54,7 +71,6 @@ static int sysv_readlink(struct inode * inode, char * buffer, int buflen)
if (buflen > inode->i_sb->sv_block_size_1)
buflen = inode->i_sb->sv_block_size_1;
bh = sysv_file_bread(inode, 0, 0);
- iput(inode);
if (!bh)
return 0;
bh_data = bh->b_data;