Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6062710imb; Fri, 8 Mar 2019 08:28:44 -0800 (PST) X-Google-Smtp-Source: APXvYqyFmXdVvIYhQHe+nv8LWN6Ynx1kkIBrOdkzpi0SDbHJiHdGBk3w2vGLC8KlK03MD1xV7BUE X-Received: by 2002:a17:902:501:: with SMTP id 1mr19317806plf.72.1552062524692; Fri, 08 Mar 2019 08:28:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552062524; cv=none; d=google.com; s=arc-20160816; b=whV0jrEo1A4AIAdhtKZVWdnktj+WxPHkDqWcuuLTakq9OQlnVAHb918A7uqNdRveLu pGAlfmiJVZRK59Sf0YT/AEWNzPHeFxxik4WfPvSZ7buXpd+XwiNlTBod7+UAsq6vX0bL RTUckju4i1NPqbwQoICJsXy4HIZGVPlLKHijlHR5JU3hRErzcSKZ7jSidraecx2V8F++ wK2VfpXq2L8ord1TrTGHXCR0/7QaWAtwI0BbVqqFjBXjCylOXBDQD0HOVPsBJCz25ZwT KDXctqhwU4vgdsj2I8mQDps/PHYlf16JD6TOuyaayTTG+xwfKfFwfkE6VUVMey8OIURE DsDQ== 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=nJzsQZlfNirnVB3Y1zPsw0Thvj84JJ8GRUkGPxwnyeM=; b=NHSC9QXOT8YdZuUYpEtINnvz++oQc1gRzpwPxbqA3tNVXR50hBcQnhOH/Ib9LCk64G SzFJGqjql+4prWknXkB/k43c/cn7r5wf+FjVtgzTG6XyQxjNSba5+s8uGBU2ob2pdsms WqXGLwmNjn9EWkg6Y7OM91aFy2At8Vz4pLjEl0iRObPOrFuBeXTWg1YCSZzSP5FM4X7j mVJkeThRxhvfWpGyef9GwOpAr3o98RIE8BAHFJxsiMHNXAjIvyt57yqVFT0RWuGQ5b8b lmPq0Q7BH7396Nu8qyGQZzWEB+7gnsTi4yXaNOmjYTVL5Awfjgows2tqX1FxQWUSCueN 30Nw== 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 j21si6546557pgg.434.2019.03.08.08.28.28; Fri, 08 Mar 2019 08:28:44 -0800 (PST) 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 S1726625AbfCHQ2E (ORCPT + 99 others); Fri, 8 Mar 2019 11:28:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:36474 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726483AbfCHQ2B (ORCPT ); Fri, 8 Mar 2019 11:28:01 -0500 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 417CDB053; Fri, 8 Mar 2019 16:28:00 +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 1/2] ceph: factor out ceph_lookup_inode() Date: Fri, 8 Mar 2019 16:27:56 +0000 Message-Id: <20190308162757.9260-2-lhenriques@suse.com> In-Reply-To: <20190308162757.9260-1-lhenriques@suse.com> References: <20190308162757.9260-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 dfb64a5211b6..ce51e98b08ec 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1061,6 +1061,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);