From patchwork Mon Sep 12 19:29:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 9327911 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 5AA176089F for ; Mon, 12 Sep 2016 19:36:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B60328D4C for ; Mon, 12 Sep 2016 19:36:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 406D728E59; Mon, 12 Sep 2016 19:36:00 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 E4E6028D8A for ; Mon, 12 Sep 2016 19:35:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933024AbcILTfu (ORCPT ); Mon, 12 Sep 2016 15:35:50 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35989 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751321AbcILT3Z (ORCPT ); Mon, 12 Sep 2016 15:29:25 -0400 Received: by mail-wm0-f41.google.com with SMTP id b187so152073117wme.1 for ; Mon, 12 Sep 2016 12:29:25 -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=TJIibh1ocjaTeQDgkcZdYGqo8sKGfKFU+nol+GPE0SE=; b=DTfaHoJ9w/UZkx9FdkRGD5VD2vMVdO9vB3AqqnyBuOGTjJZHQCen1GPlC+NML7nmcc dkWdsB+00SgLWdczlWaLZyRfi5taXmup2K1xmprrPN5yAv/njUv6YHtDAGPSKFWn1qJT H3PZNXwgzlSQfYnaqe+b352kF4h5MyfCHjj1u82Bgjc67oyXwzYcpvPPINIjEO/v4k4Z urCkwZVxjKUoyPckx32MqPm3l/50L4OO4joV/oR2pfk7EcZ6WwMvc80g3vOeQBW1NOqb TwWO58s9z3b1LNfuJd5YXbbYicJeprTa1c0ugRJjE0U6LGiJJ35ag3pRv6nXbjmUV6Zd mJ/w== X-Gm-Message-State: AE9vXwO2RsNtL8ofzBC9T9z75TrnhL4SLVVrUiCXQfHubRkpO6yqBVkgifHwQLoBJXeNXN6X X-Received: by 10.194.234.69 with SMTP id uc5mr18793259wjc.76.1473708564202; Mon, 12 Sep 2016 12:29:24 -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.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Sep 2016 12:29:23 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Al Viro Subject: [PATCH 02/17] ovl: use generic_readlink Date: Mon, 12 Sep 2016 21:29:04 +0200 Message-Id: <1473708559-12714-3-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. All filesystems that are backers for overlayfs would also use generic_readlink(). Move this logic to the overlay itself, which is a nice cleanup in itself. Signed-off-by: Miklos Szeredi --- fs/overlayfs/inode.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index c75625c1efa3..3b636e3acda4 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -173,25 +173,6 @@ static const char *ovl_get_link(struct dentry *dentry, return p; } -static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz) -{ - struct path realpath; - struct inode *realinode; - const struct cred *old_cred; - int err; - - ovl_path_real(dentry, &realpath); - realinode = realpath.dentry->d_inode; - - if (!realinode->i_op->readlink) - return -EINVAL; - - old_cred = ovl_override_creds(dentry->d_sb); - err = realinode->i_op->readlink(realpath.dentry, buf, bufsiz); - revert_creds(old_cred); - return err; -} - bool ovl_is_private_xattr(const char *name) { return strncmp(name, OVL_XATTR_PREFIX, @@ -378,7 +359,7 @@ static const struct inode_operations ovl_file_inode_operations = { static const struct inode_operations ovl_symlink_inode_operations = { .setattr = ovl_setattr, .get_link = ovl_get_link, - .readlink = ovl_readlink, + .readlink = generic_readlink, .getattr = ovl_getattr, .setxattr = generic_setxattr, .getxattr = generic_getxattr,