From patchwork Mon Sep 12 19:29:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 9327857 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 1DCB9608A0 for ; Mon, 12 Sep 2016 19:32:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E8E728E59 for ; Mon, 12 Sep 2016 19:32:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 030FD28E6F; Mon, 12 Sep 2016 19:32:12 +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=unavailable 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 68D8B28E93 for ; Mon, 12 Sep 2016 19:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757109AbcILTcH (ORCPT ); Mon, 12 Sep 2016 15:32:07 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:34829 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932551AbcILT3n (ORCPT ); Mon, 12 Sep 2016 15:29:43 -0400 Received: by mail-wm0-f47.google.com with SMTP id a6so70855819wmc.0 for ; Mon, 12 Sep 2016 12:29:43 -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=LcUKFkwa3abmp17HHzKOidF45RsSnvi0r7VmAhfD1eo=; b=g7+/H+WUNaBYuJq2j7/67K3mHDvB1vJ9oLEcFtsrsslUNDPOG+QuDp4a7DU6S/Qx/b eCRd2RCJu9wTijl/b2BQBADAcYw5naIVLN/IaAnjSRW1aYSYS8R262ZMQATjrEqX5pMo gntLnNd274SFZoYL231Tbi7zzZdKKwZ/G7VLRCCxQkk9zbcafq9nkX988OmXRW8K74JQ R0XfevCIiOvVZgl3PPweKTqkhNwyjlAOt94OUTkjXksEMTK47ChMjPtylGysrQppd13N AToxX4zk/vpHxkpGM2LpRjnrju+UuQ2zjT+NN6pHeEgsNLvFM7ckmTHTMr3fC5dBRMzR j3bg== X-Gm-Message-State: AE9vXwOW3MTaKc6CwYqA3mjnDZA4QOuZCkAp0QRxOTXTnqwHEFGFAyyJ/eXTuCETlphtdZ76 X-Received: by 10.28.96.195 with SMTP id u186mr11550188wmb.5.1473708581454; Mon, 12 Sep 2016 12:29:41 -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.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Sep 2016 12:29:40 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Al Viro Subject: [PATCH 13/17] vfs: remove unused i_op->readlink Date: Mon, 12 Sep 2016 21:29:15 +0200 Message-Id: <1473708559-12714-14-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 removes the iop->readlink method, which is now completely unused. Documentation is updated and a note added to "porting". Signed-off-by: Miklos Szeredi --- Documentation/filesystems/Locking | 2 -- Documentation/filesystems/porting | 15 +++++++++++++++ Documentation/filesystems/vfs.txt | 25 ++++++++++++------------- include/linux/fs.h | 3 --- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index d30fb2cb5066..1aa8894ef551 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking @@ -54,7 +54,6 @@ prototypes: struct inode *, struct dentry *); int (*rename2) (struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); - int (*readlink) (struct dentry *, char __user *,int); const char *(*get_link) (struct dentry *, struct inode *, void **); void (*truncate) (struct inode *); int (*permission) (struct inode *, int, unsigned int); @@ -85,7 +84,6 @@ unlink: yes (both) rmdir: yes (both) (see below) rename: yes (all) (see below) rename2: yes (all) (see below) -readlink: no get_link: no setattr: yes permission: no (may not block if called in rcu-walk mode) diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index b1bd05ea66b2..dcd2b77a9f90 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting @@ -592,3 +592,18 @@ in your dentry operations instead. work just as well; if it's something more complicated, use dentry->d_parent. Just be careful not to assume that fetching it more than once will yield the same value - in RCU mode it could change under you. +-- +[mandatory] + ->readlink() i_op is gone, all of its functionality taken over by + ->get_link(). If the filesystem set .readlink to generic_readlink, + then it doesn't need to do anything besides removing this + assignment. + + In the unlikely case that ->get_link() calls nd_jump_link(), then + it needs to do that conditionally, only if is_following_link() + returns true. Otherwise it should return the string representation + of the symlink, as the old ->readlink() implementation did. + + If the filesystem set .readlink but not .get_link, then it needs to + port the readlink implementation to the get_link interface and set + IOP_NOFOLLOW in inode->i_opflags to prevent following the symlink. diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 9ace359d6cc5..3914dc728151 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt @@ -349,7 +349,6 @@ struct inode_operations { struct inode *, struct dentry *); int (*rename2) (struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); - int (*readlink) (struct dentry *, char __user *,int); const char *(*get_link) (struct dentry *, struct inode *, struct delayed_call *); int (*permission) (struct inode *, int); @@ -430,19 +429,19 @@ otherwise noted. exist; this is checked by the VFS. Unlike plain rename, source and target may be of different type. - readlink: called by the readlink(2) system call. Only required if - you want to support reading symbolic links - - get_link: called by the VFS to follow a symbolic link to the + get_link: called by the VFS to read or follow a symbolic link to the inode it points to. Only required if you want to support - symbolic links. This method returns the symlink body - to traverse (and possibly resets the current position with - nd_jump_link()). If the body won't go away until the inode - is gone, nothing else is needed; if it needs to be otherwise - pinned, arrange for its release by having get_link(..., ..., done) - do set_delayed_call(done, destructor, argument). - In that case destructor(argument) will be called once VFS is - done with the body you've returned. + symbolic links. This method returns the symlink body (and if + is_following_link() is true, then possibly resets the current + position with nd_jump_link()). + + If the body won't go away until the inode is gone, nothing else + is needed; if it needs to be otherwise pinned, arrange for its + release by having get_link(..., ..., done) do + set_delayed_call(done, destructor, argument). In that case + destructor(argument) will be called once VFS is done with the + body you've returned. + May be called in RCU mode; that is indicated by NULL dentry argument. If request can't be handled without leaving RCU mode, have it return ERR_PTR(-ECHILD). diff --git a/include/linux/fs.h b/include/linux/fs.h index bcb0bc774cb6..31e940cb7a4f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1722,9 +1722,6 @@ struct inode_operations { const char * (*get_link) (struct dentry *, struct inode *, struct delayed_call *); int (*permission) (struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); - - int (*readlink) (struct dentry *, char __user *,int); - int (*create) (struct inode *,struct dentry *, umode_t, bool); int (*link) (struct dentry *,struct inode *,struct dentry *); int (*unlink) (struct inode *,struct dentry *);