From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932679AbcILTfF (ORCPT ); Mon, 12 Sep 2016 15:35:05 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:36026 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758106AbcILT32 (ORCPT ); Mon, 12 Sep 2016 15:29:28 -0400 From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Al Viro , David Howells Subject: [PATCH 04/17] afs: use generic_readlink Date: Mon, 12 Sep 2016 21:29:06 +0200 Message-Id: <1473708559-12714-5-git-send-email-mszeredi@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1473708559-12714-1-git-send-email-mszeredi@redhat.com> References: <1473708559-12714-1-git-send-email-mszeredi@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: David Howells --- 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