Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp521169img; Thu, 21 Mar 2019 03:21:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1z4tx5UZ+NHmxinhOvoZrPJjIk9ujK0HliKdDMlK5Wi4F/QntIn50V+0NjdMSdnhDJDac X-Received: by 2002:a17:902:681:: with SMTP id 1mr2754955plh.31.1553163675714; Thu, 21 Mar 2019 03:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553163675; cv=none; d=google.com; s=arc-20160816; b=VJjhtq+sm6NJ2+iAN9NzbWUXBX2Y1ii+9PPKtn25WtTR6b7yVnO+srMwctSRnrnLJ/ 0gEdBtMdd41pQPzu62BxjUDr3smtiaW96qjuTWSWnJ3VjcILAVv9K2w9iIqcdlk4WsG5 GXX2tQ8oOVrxlXJTUtnaduxjvVG7mg+BIqPSvyw4aj5hkYdZ6vQS/M6glVqOhsTVd2eK xvYRx6PsMpZAktzmdlThV9ORYpgkFvMiMLRXv5fjZlwlEzIL4JTKTLKt+huJU73ga84u 6TwzwOAKnbrRWyDNIA+WWylvkyXb6kQ+iHtz/JOuikt8CZJz3FZK8DUQdnO0gnXrIIkp KRFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wUid9QoG0OucGAZfn4ZeXQkbQGHvaoht9Vk44FlqXmw=; b=dadYj4s9z5wO0RVIzx080RkHXjDyfxAJyS2tMyBQSYd/pqYiKpMuQe1dbBZfC9+tyi xpSbbxVEcGwqPKIQhh1fN8egNmLi6fR1jEO8Dql5tUypkTLdfmOr5aZU4bpsdnxSoPY7 uHjfesron4t+gd/Zp+OmmPlpLjfwyhzUog6u38DAH5boMsuhshLydccDwN+++lPaZ5kE 0zTZTEhs9ttB1DoLLk6VHIjpV7njWF+MbvpYVNzptZo/YvLHH+hs5/waviPpcdo4vehq XMOd5W29NdEAiZpVLrCA+0ol1TdI+/NnoKiw4N0u3hfuV3oBUjETKgfi/EXsnfX0r+fg 6bhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r15si3653955pgv.389.2019.03.21.03.20.57; Thu, 21 Mar 2019 03:21:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728078AbfCUKUR (ORCPT + 99 others); Thu, 21 Mar 2019 06:20:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:57256 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727967AbfCUKUO (ORCPT ); Thu, 21 Mar 2019 06:20:14 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 53912AF3F; Thu, 21 Mar 2019 10:20:13 +0000 (UTC) From: Luis Henriques To: "Yan, Zheng" , Sage Weil , Ilya Dryomov Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Luis Henriques Subject: [PATCH v3 1/2] ceph: factor out ceph_lookup_inode() Date: Thu, 21 Mar 2019 10:20:09 +0000 Message-Id: <20190321102010.26958-2-lhenriques@suse.com> In-Reply-To: <20190321102010.26958-1-lhenriques@suse.com> References: <20190321102010.26958-1-lhenriques@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This function will be used by __fh_to_dentry and by the quotas code, to find quota realm inodes that are not visible in the mountpoint. Signed-off-by: Luis Henriques --- fs/ceph/export.c | 14 +++++++++++++- fs/ceph/super.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/ceph/export.c b/fs/ceph/export.c index 3c59ad180ef0..0d8ead82c816 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c @@ -59,7 +59,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, return type; } -static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) +struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino) { struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; struct inode *inode; @@ -92,12 +92,24 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) ceph_mdsc_put_request(req); if (!inode) return ERR_PTR(-ESTALE); + if (err) + return ERR_PTR(err); if (inode->i_nlink == 0) { iput(inode); return ERR_PTR(-ESTALE); } } + return inode; +} + +static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) +{ + struct inode *inode = ceph_lookup_inode(sb, ino); + + if (IS_ERR(inode)) + return ERR_CAST(inode); + return d_obtain_alias(inode); } diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 16c03188578e..976f200164f9 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1082,6 +1082,7 @@ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg); /* export.c */ extern const struct export_operations ceph_export_ops; +struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino); /* locks.c */ extern __init void ceph_flock_init(void);