aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Henriques <lhenriques@suse.com>2019-03-21 06:20:09 -0400
committerIlya Dryomov <idryomov@gmail.com>2019-05-07 13:22:36 -0400
commit3886274adf34a4e38417772e3d1c0b213380004e (patch)
treee72c79e8deac454d36538894e162694b02d2af3c
parent1b52931ca9b5b87e237c591f99201b6254c00809 (diff)
ceph: factor out ceph_lookup_inode()
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 <lhenriques@suse.com> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--fs/ceph/export.c14
-rw-r--r--fs/ceph/super.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 3c59ad180ef0..d64e7472fa41 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,
59 return type; 59 return type;
60} 60}
61 61
62static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) 62struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino)
63{ 63{
64 struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; 64 struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
65 struct inode *inode; 65 struct inode *inode;
@@ -91,13 +91,23 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
91 ihold(inode); 91 ihold(inode);
92 ceph_mdsc_put_request(req); 92 ceph_mdsc_put_request(req);
93 if (!inode) 93 if (!inode)
94 return ERR_PTR(-ESTALE); 94 return err < 0 ? ERR_PTR(err) : ERR_PTR(-ESTALE);
95 if (inode->i_nlink == 0) { 95 if (inode->i_nlink == 0) {
96 iput(inode); 96 iput(inode);
97 return ERR_PTR(-ESTALE); 97 return ERR_PTR(-ESTALE);
98 } 98 }
99 } 99 }
100 100
101 return inode;
102}
103
104static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
105{
106 struct inode *inode = ceph_lookup_inode(sb, ino);
107
108 if (IS_ERR(inode))
109 return ERR_CAST(inode);
110
101 return d_obtain_alias(inode); 111 return d_obtain_alias(inode);
102} 112}
103 113
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);
1082 1082
1083/* export.c */ 1083/* export.c */
1084extern const struct export_operations ceph_export_ops; 1084extern const struct export_operations ceph_export_ops;
1085struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino);
1085 1086
1086/* locks.c */ 1087/* locks.c */
1087extern __init void ceph_flock_init(void); 1088extern __init void ceph_flock_init(void);