Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1481921

[PATCH 04/17] afs: use generic_readlink

From Miklos Szeredi <mszeredi@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 04/17] afs: use generic_readlink
Date 2016-09-12 21:40 +0200
Message-ID <sgFfd-7H4-63@gated-at.bofh.it> (permalink)
References <sgF5v-7Bx-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This will allow us to move the generic readlink logic into the VFS and get
rid of the readlink method.

AFS mountpoints seem to be special symlinks that can be read but not
followed.  So add IOP_NOFOLLOW to i_opflags and use page_get_link +
generic_readlink instead of page_readlink.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: David Howells <dhowells@redhat.com>
---
 fs/afs/inode.c | 2 ++
 fs/afs/mntpt.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 86cc7264c21c..56709b2c46e3 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -88,6 +88,8 @@ static int afs_inode_map_status(struct afs_vnode *vnode, struct key *key)
 			inode->i_mode	= S_IFDIR | vnode->status.mode;
 			inode->i_op	= &afs_mntpt_inode_operations;
 			inode->i_fop	= &afs_mntpt_file_operations;
+			/* Not a real symlink, don't follow */
+			inode->i_opflags |= IOP_NOFOLLOW;
 		}
 	}
 
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 81dd075356b9..7d170de2ce1b 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -33,7 +33,8 @@ const struct file_operations afs_mntpt_file_operations = {
 
 const struct inode_operations afs_mntpt_inode_operations = {
 	.lookup		= afs_mntpt_lookup,
-	.readlink	= page_readlink,
+	.get_link	= page_get_link,
+	.readlink	= generic_readlink,
 	.getattr	= afs_getattr,
 };
 
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/17] clean up readlinks Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200
  [PATCH 08/17] proc: merge proc_pid_readlink() into proc_pid_get_link() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200
  [PATCH 15/17] vfs: add vfs_get_link() helper Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200
  [PATCH 09/17] proc: merge proc_ns_readlink() into proc_ns_get_link() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200
  [PATCH 04/17] afs: use generic_readlink Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200
  [PATCH 12/17] vfs: remove ".readlink = generic_readlink" assignments Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200
  [PATCH 06/17] vfs: remove page_readlink() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200
  [PATCH 03/17] proc/self: use generic_readlink Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200
  [PATCH 16/17] ovl: use vfs_get_link() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-12 21:40 +0200

csiph-web