patch-2.1.44 linux/fs/autofs/symlink.c

Next file: linux/fs/autofs/waitq.c
Previous file: linux/fs/autofs/root.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.43/linux/fs/autofs/symlink.c linux/fs/autofs/symlink.c
@@ -19,18 +19,21 @@
 	struct autofs_symlink *sl;
 	int len;
 
-	if (!S_ISLNK(inode->i_mode)) {
-		iput(inode);
-		return -EINVAL;
-	}
 	sl = (struct autofs_symlink *)inode->u.generic_ip;
 	len = sl->len;
 	if (len > buflen) len = buflen;
 	copy_to_user(buffer,sl->data,len);
-	iput(inode);
 	return len;
 }
 
+static struct dentry * autofs_follow_link(struct inode *inode, struct dentry *base)
+{
+	struct autofs_symlink *sl;
+
+	sl = (struct autofs_symlink *)inode->u.generic_ip;
+	return lookup_dentry(sl->data, base, 1);
+}
+
 struct inode_operations autofs_symlink_inode_operations = {
 	NULL,			/* file operations */
 	NULL,			/* create */
@@ -43,6 +46,7 @@
 	NULL,			/* mknod */
 	NULL,			/* rename */
 	autofs_readlink,	/* readlink */
+	autofs_follow_link,	/* follow_link */
 	NULL,			/* readpage */
 	NULL,			/* writepage */
 	NULL,			/* bmap */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov