Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2114199imc; Tue, 12 Mar 2019 07:21:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnfynEVqC1YeIyadKMwHrHvKQRhu6LjMgxUMTItwDHWuQIHwwC1fckyKtMV7MvO6UfQXJl X-Received: by 2002:a65:514a:: with SMTP id g10mr8451436pgq.400.1552400469706; Tue, 12 Mar 2019 07:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552400469; cv=none; d=google.com; s=arc-20160816; b=ZrMkfmQ9QU68xovm2WGD66lhSk+s0z846YmGL63n9/Jx4PJ3ixi14fC59KTSU9fLlp eo92fVcRVNoTL8kysI1Kzc6Lt8fD1g7U1WxMGDP2KV8uIeOcfjIc59v386A4z+uhoqL4 EtqihfRERujmJal2ii/8Hc0w36nND/h2NEdG471ktHK48llYXdo/xwJgk+mJyvmwTgw7 lD1sHnWXnn7wxwMVTm4bd2VgZCPR5t/OYFCLAHaqe/vbZHTjqbxZhTWHgQMnmisMEUbN v8JnETNV1YR13AY9OvRuHTFlLHNaBZjTBSNvJwrqiUVAR5T6iZA7apsOQhESbzWcCCJn JLSQ== 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=QcrhupMrCukjL4eedkwg7KqderoGF7b8KvL1Of+pRuU=; b=QBNwlM/N3FyxGaftuq+JYsnzLN2n16x6morLiGauv9jL85MNpz6T3PEDiM7Rp5q6EO Vj06l793bI/6KXuYdciY+Ea8ip+Fqq7VzpXYQPfhFfWOwmerjJJF3VxiWiaxjocxqtGC 0E8viXyd/9ynflPokI/HuTmxSjffbrjVe7Ho2GkN7n7kQEbBEOcoAI10iwyUJ6yLTI1X 3VnqFXB9VYVrY2eQKyGplsp7JPXvrZfA0jp0amqp/A9rL2f1mTQP750/pfK4IHKk3FEj VANFo5KOGTzJ2qb2fT8DP6Ry800GV0iY87UE3Y5TEyE+0yL4+iU5bsG5Am8ywrVPMd+e RDBw== 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 t129si7850466pgc.525.2019.03.12.07.20.53; Tue, 12 Mar 2019 07:21:09 -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 S1726865AbfCLOU2 (ORCPT + 99 others); Tue, 12 Mar 2019 10:20:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:58444 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726817AbfCLOUX (ORCPT ); Tue, 12 Mar 2019 10:20:23 -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 9A007B646; Tue, 12 Mar 2019 14:20:22 +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 v2 1/2] ceph: factor out ceph_lookup_inode() Date: Tue, 12 Mar 2019 14:20:18 +0000 Message-Id: <20190312142019.30936-2-lhenriques@suse.com> In-Reply-To: <20190312142019.30936-1-lhenriques@suse.com> References: <20190312142019.30936-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);