From patchwork Mon Sep 12 19:29:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 9327889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C15366077F for ; Mon, 12 Sep 2016 19:34:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2EA228E59 for ; Mon, 12 Sep 2016 19:34:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A74FD28E93; Mon, 12 Sep 2016 19:34:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 472D228E59 for ; Mon, 12 Sep 2016 19:34:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758128AbcILT3a (ORCPT ); Mon, 12 Sep 2016 15:29:30 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38509 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757109AbcILT32 (ORCPT ); Mon, 12 Sep 2016 15:29:28 -0400 Received: by mail-wm0-f53.google.com with SMTP id 1so163049101wmz.1 for ; Mon, 12 Sep 2016 12:29:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bzgzTnlM1OUWoPgvBUOyBsvntbIqBjfXp9pC7kx83Us=; b=QtbpAxNw3lb5b9pn7qxibNvvEyPVXK0DBb/qjz1i4BF1xb8LPNvnA1SnD9rNCdunYK mxBYj3Dj0l5VMUxyWYWloQ1Xzx0yqPeYk6iym/aXr8V5/hHYtMwBRkgaxyHxDxO+d9Bi cxK9NK1kuAMWrtcbiQjLte8r9WddKYQrcZrH/XCPRzYZuTuXoYaGMRjp50kprUIxwsSW LJgBOm/lAmIOYC+EzHPekAZR97+xKEdd34s5yXDEdNG1O+zSrqRaevqQ6GqvAMoXyWnF 0Rr+YZPVO0iqQY1S9FpYuQbcdSmUMWrfX+6zxJhDM0QDPrx/IUQIYZ1kh4rUauyHPiEi cFbg== X-Gm-Message-State: AE9vXwNZB6wm5FsBROUo0lGu4SRtXi+aYv1eMVU+mc8UK6K8TsdpkfysngROi5cr1iuIr6kO X-Received: by 10.194.190.37 with SMTP id gn5mr3777859wjc.168.1473708567177; Mon, 12 Sep 2016 12:29:27 -0700 (PDT) Received: from veci.piliscsaba.szeredi.hu (pool-dsl-2c-0018.externet.hu. [217.173.44.24]) by smtp.gmail.com with ESMTPSA id f8sm19250418wjh.45.2016.09.12.12.29.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Sep 2016 12:29:26 -0700 (PDT) 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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, };